The following invalid code snippet causes an ICE since at least gcc 2.95.3:
============================== template<typename T> struct A { template<T&> struct B; }; A<void> a; ============================== bug3.cc: In instantiation of 'A<void>': bug3.cc:6: instantiated from here bug3.cc:3: error: forming reference to void bug3.cc:3: internal compiler error: tree check: expected tree_vec, have error_mark in retrieve_specialization, at cp/pt.c:822 Please submit a full bug report, [etc.] Using "int&" instead of "void" to instantiate the template also causes an ICE. -- Summary: ICE on invalid reference in template parameter Product: gcc Version: 4.0.0 Status: UNCONFIRMED Keywords: ice-on-invalid-code, error-recovery, monitored Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: reichelt at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19498