The following invalid testcase triggers an ICE since GCC 4.1.2: ================================================ template<typename> struct A { template<int> struct B { typedef A X; }; };
template<typename T> struct C { class A<T>::template B<0>::X x; }; C<int> c; ================================================ bug.cc: In instantiation of 'A<int>::B<0>': bug.cc:8: instantiated from 'C<int>' bug.cc:11: instantiated from here bug.cc:3: internal compiler error: in instantiate_class_template, at cp/pt.c:6765 Please submit a full bug report, [etc.] The code was accepted before. If I make B a non-template the situation is reversed, i.e. the code is wrongly accepted since GCC 4.1.2 while it ICE'd before: ================================================ template<typename> struct A { struct B { typedef A X; }; }; template<typename T> struct C { class A<T>::B::X x; }; C<int> c; ================================================ The problem is probably related to PR32029 (which ICEs since GCC 3.4.0, though). -- Summary: [4.1/4.2/4.3 regression] ICE using class instead of typename Product: gcc Version: 4.3.0 Status: UNCONFIRMED Keywords: ice-on-invalid-code, accepts-invalid, monitored Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: reichelt at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34487