1 // RUN: %clang_cc1 -fsyntax-only -verify %s 2 3 // PR5811 4 template <class F> void Call(F f) { f(1); } 5 template <typename T> void f(T); 6 void a() { Call(f<int>); } 7 8 // Check the conversion of a template-id to a pointer 9 template<typename T, T* Address> struct Constant { }; 10 Constant<void(int), &f<int> > constant0; 11 12 template<typename T, T* Address> void constant_func(); 13 void test_constant_func() { 14 constant_func<void(int), &f<int> >(); 15 } 16 17 18 // Check typeof() on a template-id referring to a single function 19 template<typename T, typename U> 20 struct is_same { 21 static const bool value = false; 22 }; 23 24 template<typename T> 25 struct is_same<T, T> { 26 static const bool value = true; 27 }; 28 29 int typeof0[is_same<__typeof__(f<int>), void (int)>::value? 1 : -1]; 30 int typeof1[is_same<__typeof__(&f<int>), void (*)(int)>::value? 1 : -1]; 31 32 template <typename T> void g(T); // expected-note{{candidate function}} 33 template <typename T> void g(T, T); // expected-note{{candidate function}} 34 35 int typeof2[is_same<__typeof__(g<float>), void (int)>::value? 1 : -1]; // \ 36 // expected-error{{cannot resolve overloaded function 'g' from context}} 37