// Origin: PR c++/42713 // { dg-do compile } template struct S { }; template struct S0 { typedef T TT; }; template struct super_struct : S0 { typedef S0 super; }; template struct S1 : super_struct { typedef super_struct super; typedef typename super::super Super2; typedef typename Super2::TT Super2TT; void foo() { S s1; } }; template struct S2 : super_struct { typedef super_struct super; typedef typename super::super Super2; typedef typename Super2::TT Super2TT; void foo() { S s1; } }; int main() { S1, int> s1; s1.foo(); S2 > s2; s2.foo(); }