The following invalid code snippet triggers an ICE since at least GCC 2.95.3:
======================================== template<int> struct A { A(); }; template<int N, char> A<N>::A() { struct B {}; } A<0> a; ======================================== bug.cc:6: error: got 2 template parameters for 'A<<anonymous> >::A()' bug.cc:6: error: but 1 required bug.cc: In constructor 'A<<anonymous> >::A() [with int <anonymous> = 0]': bug.cc:11: instantiated from here bug.cc:8: internal compiler error: tree check: accessed elt 2 of tree_vec with 1 elts in tsubst, at cp/pt.c:9048 Please submit a full bug report, [etc.] -- Summary: ICE with wrong number of template parameters Product: gcc Version: 4.4.0 Status: UNCONFIRMED Keywords: ice-on-invalid-code, error-recovery, 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=38634