The following valid code snippet triggers an ICE since at least GCC 2.95.3:
================================= template<int> struct A { template<int> struct B { template<int> void foo() { struct C { C() {} }; } }; }; ================================= bug.cc: In member function 'void A<<anonymous> >::B<<anonymous> >::foo()': bug.cc:7: internal compiler error: tree check: expected class 'type', have 'declaration' (function_decl) in push_template_decl_real, at cp/pt.c:3857 Please submit a full bug report, [etc.] -- Summary: ICE on nested templates Product: gcc Version: 4.3.0 Status: UNCONFIRMED Keywords: ice-on-valid-code, 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=31516