Debian Codegraph @

gcc/testsuite/g++.dg/template/error38.C

raw
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 a.g(); // { dg-error "" }
36
37 f(i); // { dg-error "" }
38 f(p); // { dg-error "" }
39 }