p3-nodeduct.cpp revision 2cd11fefb62c580651e4269e1488381c2d6d07ad
1// RUN: %clang_cc1 -fsyntax-only -verify %s
2
3// PR5811
4template <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 pointer
9template<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 function
19template<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);
33template <typename T> void g(T, T);
34
35int typeof2[is_same<__typeof__(g<float>), void (int)>::value? 1 : -1]; // \
36     // expected-error{{cannot resolve overloaded function from context}}
37