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
3 
4 namespace PR8446_1 {
5 struct A {
6   typedef int BASE_VALUE;
7 };
8 
g(int & y)9 void g(int &y) {}
10 
11 template <typename BASE_CLASS>
f(int & rValue)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);
19 }
20 
main()21 int main() {
22   int x;
23   f<A>(x);
24   return 0;
25 }
26 } // namespace PR8446_1
27 
28 
29 namespace PR8446_2 {
30 struct site_symmetry_ops {};
31 
32 template <class wt>
33 struct class_ {
34   template <class A1>
defPR8446_2::class_35   void def(A1 const &a1) {}
36 };
37 
38 template <class A1, class A2>
39 struct init {
initPR8446_2::init40   init() {}
41 };
42 
43 struct special_position_site_parameter {
44   typedef char scatterer_type;
45 };
46 
47 template <class wt>
48 struct valued_asu_parameter_heir_wrapper {
wrapPR8446_2::valued_asu_parameter_heir_wrapper49   static class_<wt> wrap(char const *name) {
50     return class_<wt>();
51   }
52 };
53 
54 template <class wt>
55 struct special_position_wrapper {
wrapPR8446_2::special_position_wrapper56   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 *>());
64   }
65 };
66 
wrap_special_position()67 void wrap_special_position() {
68   special_position_wrapper<special_position_site_parameter>::wrap("special_position_site_parameter");
69 }
70 } // namespace PR8446_2
71 
72 namespace PR8446_3 {
73 int g(int);
74 template <typename T>
f1(int x)75 int f1(int x) {
76   return g((T::InnerName & x) & x);
77 }
78 
79 template <typename T>
f2(int x)80 int f2(int x) {
81   return g((T::InnerName & 3) & x);
82 }
83 
84 template <typename T>
f3(int x)85 int f3(int x) {
86   return g((T::InnerName & (3)));
87 }
88 
89 template <typename T>
f4(int x)90 int f4(int x) {
91   return g((T::InnerName * 3) & x);
92 }
93 struct A {
94   static const int InnerName = 42;
95 };
main()96 int main() {
97   f1<A>(0);
98   f2<A>(0);
99   f3<A>(0);
100   return f4<A>(0);
101 }
102 } // namespace PR8446_3
103