The following invalid testcase causes an ICE since GCC 3.1: ======================================== template<int, int = 0> struct A;
template<int> struct A { A(); }; A<0> a; ======================================== bug.cc:1: error: previous declaration 'template<int <anonymous>, int <anonymous> > struct A' bug.cc:3: error: used 2 template parameter(s) instead of 1 bug.cc: In constructor 'A<<anonymous>, <anonymous> >::A() [with int <anonymous> = 0]': bug.cc:8: instantiated from here bug.cc:5: internal compiler error: tree check: accessed elt 2 of tree_vec with 1 elts in tsubst, at cp/pt.c:7080 Please submit a full bug report, [etc.] -- Summary: [4.0/4.1/4.2 regression] ICE with wrong number of template parameters Product: gcc Version: 4.2.0 Status: UNCONFIRMED Keywords: ice-on-invalid-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=26938