OSDN Git Service

PR c++/47705
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / template / typedef27.C
1 // Origin: PR c++/42713
2 // { dg-do compile }
3
4 template<class T>
5 struct S
6 {
7 };
8
9 template<class T>
10 struct S0
11 {
12     typedef T TT;
13 };
14
15 template<class U, class V>
16 struct super_struct : S0<V>
17 {
18     typedef S0<V> super;
19 };
20
21 template<class U, class V, class W>
22 struct S1 : super_struct<U, V>
23 {
24     typedef super_struct<U, V> super;
25     typedef typename super::super Super2;
26     typedef typename Super2::TT Super2TT;
27     void
28     foo()
29     {
30         S<Super2TT> s1;
31     }
32 };
33
34 template<class U, class V>
35 struct S2 : super_struct<U, V>
36 {
37     typedef super_struct<U, V> super;
38     typedef typename super::super Super2;
39     typedef typename Super2::TT Super2TT;
40     void
41     foo()
42     {
43         S<Super2TT> s1;
44     }
45 };
46
47 int
48 main()
49 {
50     S1<int, S<int>, int> s1;
51     s1.foo();
52     S2<int, S<int> > s2;
53     s2.foo();
54 }
55