OSDN Git Service

PR c++/24163
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / template / error38.C
1 // Testcase for printing typename/typedef bindings as well as template args
2 // in diagnostics (PR c++/25185)
3
4 template <class T>
5 struct A {
6   typename T::type f();         // { dg-message "typename T::type = void*" }
7   void f(int i = 0);            // { dg-message "" }
8
9   typedef typename T::type mytype;
10   mytype g();                   // { dg-message "mytype = void*" }
11   void g(int i = 0);            // { dg-message "" }
12 };
13
14 struct B
15 {
16   typedef void* type;
17 };
18
19 // Also make sure that deduced template arguments get canonicalized.
20
21 template <class T>
22 void f (T &t);                  // { dg-message "T = int" }
23
24 template <class T>
25 void f (T &t, int = 0);         // { dg-message "" }
26
27 typedef int myint;
28 myint i;
29 myint *p;
30
31 int main()
32 {
33   A<B> a;
34   a.f();                        // { dg-error "" }
35   // { dg-message "candidate" "candidate note" { target *-*-* } 34 }
36   a.g();                        // { dg-error "" }
37   // { dg-message "candidate" "candidate note" { target *-*-* } 36 }
38
39   f(i);                         // { dg-error "" }
40   // { dg-message "candidate" "candidate note" { target *-*-* } 39 }
41   f(p);                         // { dg-error "" }
42   // { dg-message "candidate" "candidate note" { target *-*-* } 41 }
43 }