The following invalid code snippet causes an ICE on mainline: ============================= template<int(> struct A; =============================
bugA.cc:1: error: expected `)' before '>' token bugA.cc:1: internal compiler error: tree check: accessed elt 1 of tree_vec with 0 elts in get_innermost_template_args, at cp/pt.c:490 Please submit a full bug report, [etc.] A similar testcase causes an ICE in a different function: ============================= template<typename> struct A { template<int(> struct B; }; A<char> a; ============================= bugB.cc:3: error: expected `)' before '>' token bugB.cc: In instantiation of 'A<char>': bugB.cc:6: instantiated from here bugB.cc:3: internal compiler error: tree check: accessed elt 1 of tree_vec with 0 elts in add_outermost_template_args, at cp/pt.c:459 Please submit a full bug report, [etc.] The second testcase also ICEd before GCC 3.4.0. -- Summary: [4.2 regression] ICE on invalid template argument Product: gcc Version: 4.2.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=27397