Debian Codegraph @

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

raw
1 // Contributed by Dodji Seketeli <[email protected]>
2 // Origin PR c++/42225
3 // { dg-do compile { target c++11 } }
4
5 template<class T>
6 struct A
7 {
8 typedef T I;
9 static const char *i;
10 };
11
12 template<class T, int>
13 struct B
14 {
15 typedef T TT;
16 typedef decltype(TT::i) TT_I0;
17 typedef decltype(&TT::i) TT_I1;
18 typedef decltype(*TT::i) TT_I2;
19 typedef A<TT_I0> TA0;
20 typedef A<TT_I1> TA1;
21 typedef A<TT_I2> TA2;
22 };
23
24 template<class T>
25 void
26 foo()
27 {
28 typedef T TT;
29 typedef decltype(TT::i) TT_I0;
30 typedef decltype(&TT::i) TT_I1;
31 typedef decltype(*TT::i) TT_I2;
32 typedef A<TT_I0> TA0;
33 typedef A<TT_I1> TA1;
34 typedef A<TT_I2> TA2;
35 }
36
37 int
38 main()
39 {
40 foo<A<int> >();
41 }
42