OSDN Git Service

PR c++/52685
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / template / typedef25.C
1 // Contributed by Dodji Seketeli <dodji@redhat.com>
2 // Origin PR c++/42225
3 // { dg-options "-std=c++0x" }
4 // { dg-do compile }
5
6 template<class T>
7 struct A
8 {
9     typedef T I;
10     static const char *i;
11 };
12
13 template<class T, int>
14 struct B
15 {
16     typedef T TT;
17     typedef decltype(TT::i)  TT_I0;
18     typedef decltype(&TT::i) TT_I1;
19     typedef decltype(*TT::i) TT_I2;
20     typedef A<TT_I0> TA0;
21     typedef A<TT_I1> TA1;
22     typedef A<TT_I2> TA2;
23 };
24
25 template<class T>
26 void
27 foo()
28 {
29     typedef T TT;
30     typedef decltype(TT::i)  TT_I0;
31     typedef decltype(&TT::i) TT_I1;
32     typedef decltype(*TT::i) TT_I2;
33     typedef A<TT_I0> TA0;
34     typedef A<TT_I1> TA1;
35     typedef A<TT_I2> TA2;
36 }
37
38 int
39 main()
40 {
41     foo<A<int> >();
42 }
43