1// Origin: PR c++/42713 2// { dg-do compile } 3 4template<class T> 5struct S 6{ 7}; 8 9template<class T> 10struct S0 11{ 12 typedef T TT; 13}; 14 15template<class U, class V> 16struct super_struct : S0<V> 17{ 18 typedef S0<V> super; 19}; 20 21template<class U, class V, class W> 22struct 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 34template<class U, class V> 35struct 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 47int 48main() 49{ 50 S1<int, S<int>, int> s1; 51 s1.foo(); 52 S2<int, S<int> > s2; 53 s2.foo(); 54} 55 56