This invalid code snippet produces ICE on mainline and 4.0 branch: ------------------------------------------------------------------------------- template < typename T > struct C;
template < typename T > void C < T > :: f () { const foo bar; } ------------------------------------------------------------------------------- foo.cc:3: error: invalid use of undefined type ‘struct C<T>’ foo.cc:1: error: declaration of ‘struct C<T>’ foo.cc:3: error: template definition of non-template ‘void C<T>::f()’ foo.cc: In member function ‘void C<T>::f()’: foo.cc:5: error: ‘foo’ does not name a type foo.cc:5: internal compiler error: Segmentation fault -- Summary: [4.0/4.1 regression] ICE on using undefined type Product: gcc Version: 4.1.0 Status: UNCONFIRMED Keywords: ice-on-invalid-code, error-recovery Severity: minor Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: belyshev at depni dot sinp dot msu dot ru CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20463