1 // RUN: %clang_cc1 -fsyntax-only -verify %s 2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s 3 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s 4 5 template<class T> struct A { 6 static T t; // expected-error{{static data member instantiated with function type 'int ()'}} 7 }; 8 typedef int function(); 9 A<function> a; // expected-note{{instantiation of}} 10 11 template<typename T> struct B { 12 B() { T t; } // expected-error{{variable instantiated with function type 'int ()'}} 13 }; 14 B<function> b; // expected-note{{instantiation of}} 15 16 template <typename T> int f0(void *, const T&); // expected-note{{candidate template ignored: substitution failure}} 17 enum {e}; 18 #if __cplusplus <= 199711L 19 // expected-note@-2 {{unnamed type used in template argument was declared here}} 20 #endif 21 22 void test_f0(int n) { 23 int i = f0(0, e); 24 #if __cplusplus <= 199711L 25 // expected-warning@-2 {{template argument uses unnamed type}} 26 #endif 27 28 int vla[n]; 29 f0(0, vla); // expected-error{{no matching function for call to 'f0'}} 30 } 31 32 namespace N0 { 33 template <typename R, typename A1> void f0(R (*)(A1)); 34 template <typename T> int f1(T); 35 template <typename T, typename U> int f1(T, U); 36 enum {e1}; 37 #if __cplusplus <= 199711L 38 // expected-note@-2 2{{unnamed type used in template argument was declared here}} 39 #endif 40 41 enum {e2}; 42 #if __cplusplus <= 199711L 43 // expected-note@-2 2{{unnamed type used in template argument was declared here}} 44 #endif 45 46 enum {e3}; 47 #if __cplusplus <= 199711L 48 // expected-note@-2 {{unnamed type used in template argument was declared here}} 49 #endif 50 51 template<typename T> struct X; 52 template<typename T> struct X<T*> { }; 53 54 void f() { 55 f0( 56 #if __cplusplus <= 199711L 57 // expected-warning@-2 {{template argument uses unnamed type}} 58 #endif 59 60 &f1<__typeof__(e1)>); 61 #if __cplusplus <= 199711L 62 // expected-warning@-2 {{template argument uses unnamed type}} 63 #endif 64 65 int (*fp1)(int, __typeof__(e2)) = f1; 66 #if __cplusplus <= 199711L 67 // expected-warning@-2 {{template argument uses unnamed type}} 68 #endif 69 70 f1(e2); 71 #if __cplusplus <= 199711L 72 // expected-warning@-2 {{template argument uses unnamed type}} 73 #endif 74 75 f1(e2); 76 77 X<__typeof__(e3)*> x; 78 #if __cplusplus <= 199711L 79 // expected-warning@-2 {{template argument uses unnamed type}} 80 #endif 81 } 82 } 83