[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / SemaTemplate / missing-typename.cpp
blob3f8282dcaff29ee291c49533cdbde250ef5b96ae
1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s -Wno-unused
2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s -Wno-unused -fms-compatibility -DMSVC
4 namespace PR8446_1 {
5 struct A {
6 typedef int BASE_VALUE;
7 };
9 void g(int &y) {}
11 template <typename BASE_CLASS>
12 void f(int &rValue) {
13 #if MSVC
14 // expected-warning@+4 {{missing 'typename' prior to dependent type name 'BASE_CLASS::BASE_VALUE'}}
15 #else
16 // expected-error@+2 {{expected expression}}
17 #endif
18 return g((BASE_CLASS::BASE_VALUE &)rValue);
21 int main() {
22 int x;
23 f<A>(x);
24 return 0;
26 } // namespace PR8446_1
29 namespace PR8446_2 {
30 struct site_symmetry_ops {};
32 template <class wt>
33 struct class_ {
34 template <class A1>
35 void def(A1 const &a1) {}
38 template <class A1, class A2>
39 struct init {
40 init() {}
43 struct special_position_site_parameter {
44 typedef char scatterer_type;
47 template <class wt>
48 struct valued_asu_parameter_heir_wrapper {
49 static class_<wt> wrap(char const *name) {
50 return class_<wt>();
54 template <class wt>
55 struct special_position_wrapper {
56 static void wrap(char const *name) {
57 valued_asu_parameter_heir_wrapper<wt>::wrap(name)
58 #if MSVC
59 // expected-warning@+4 {{missing 'typename' prior to dependent type name 'wt::scatterer_type'}}
60 #else
61 // expected-error@+2 {{expected expression}}
62 #endif
63 .def(init<site_symmetry_ops const &, wt::scatterer_type *>());
67 void wrap_special_position() {
68 special_position_wrapper<special_position_site_parameter>::wrap("special_position_site_parameter");
70 } // namespace PR8446_2
72 namespace PR8446_3 {
73 int g(int);
74 template <typename T>
75 int f1(int x) {
76 return g((T::InnerName & x) & x);
79 template <typename T>
80 int f2(int x) {
81 return g((T::InnerName & 3) & x);
84 template <typename T>
85 int f3(int x) {
86 return g((T::InnerName & (3)));
89 template <typename T>
90 int f4(int x) {
91 return g((T::InnerName * 3) & x);
93 struct A {
94 static const int InnerName = 42;
96 int main() {
97 f1<A>(0);
98 f2<A>(0);
99 f3<A>(0);
100 return f4<A>(0);
102 } // namespace PR8446_3