37 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2 3// PR58114template <class F> void Call(F f) { f(1); }5template <typename T> void f(T);6void a() { Call(f<int>); }7 8// Check the conversion of a template-id to a pointer9template<typename T, T* Address> struct Constant { };10Constant<void(int), &f<int> > constant0;11 12template<typename T, T* Address> void constant_func();13void test_constant_func() {14 constant_func<void(int), &f<int> >();15}16 17 18// Check typeof() on a template-id referring to a single function19template<typename T, typename U>20struct is_same {21 static const bool value = false;22};23 24template<typename T>25struct is_same<T, T> {26 static const bool value = true;27};28 29int typeof0[is_same<__typeof__(f<int>), void (int)>::value? 1 : -1];30int typeof1[is_same<__typeof__(&f<int>), void (*)(int)>::value? 1 : -1];31 32template <typename T> void g(T); // expected-note{{possible target for call}}33template <typename T> void g(T, T); // expected-note{{possible target for call}}34 35int typeof2[is_same<__typeof__(g<float>), void (int)>::value? 1 : -1]; // \36 // expected-error{{reference to overloaded function could not be resolved; did you mean to call it?}}37