1// RUN: %clang_cc1 -fsyntax-only -verify %s 2template<class T> struct A { 3 static T t; // expected-error{{static data member instantiated with function type 'int ()'}} 4}; 5typedef int function(); 6A<function> a; // expected-note{{instantiation of}} 7 8template<typename T> struct B { 9 B() { T t; } // expected-error{{variable instantiated with function type 'int ()'}} 10}; 11B<function> b; // expected-note{{instantiation of}} 12 13template <typename T> int f0(void *, const T&); // expected-note{{candidate template ignored: substitution failure}} 14enum {e}; // expected-note{{unnamed type used in template argument was declared here}} 15 16void test_f0(int n) { 17 int i = f0(0, e); // expected-warning{{template argument uses unnamed type}} 18 int vla[n]; 19 f0(0, vla); // expected-error{{no matching function for call to 'f0'}} 20} 21 22namespace N0 { 23 template <typename R, typename A1> void f0(R (*)(A1)); 24 template <typename T> int f1(T); 25 template <typename T, typename U> int f1(T, U); 26 enum {e1}; // expected-note 2{{unnamed type used in template argument was declared here}} 27 enum {e2}; // expected-note 2{{unnamed type used in template argument was declared here}} 28 enum {e3}; // expected-note{{unnamed type used in template argument was declared here}} 29 30 template<typename T> struct X; 31 template<typename T> struct X<T*> { }; 32 33 void f() { 34 f0( // expected-warning{{template argument uses unnamed type}} 35 &f1<__typeof__(e1)>); // expected-warning{{template argument uses unnamed type}} 36 int (*fp1)(int, __typeof__(e2)) = f1; // expected-warning{{template argument uses unnamed type}} 37 f1(e2); // expected-warning{{template argument uses unnamed type}} 38 f1(e2); 39 40 X<__typeof__(e3)*> x; // expected-warning{{template argument uses unnamed type}} 41 } 42} 43