The C++ frontend currently chokes on invalid typedefs in parameter declarations for both functions and templates. One can generate ICEs in many different places like the following examples show:
====================================== void foo(typedef) {} ====================================== bug.cc:1: error: ISO C++ forbids declaration of 'parameter' with no type bug.cc:1: error: typedef declaration invalid in parameter declaration bug.cc: In function 'void foo(int)': bug.cc:1: internal compiler error: tree check: expected tree that contains 'decl with RTL' structure, have 'type_decl' in set_decl_rtl, at emit-rtl.c:949 Please submit a full bug report, [etc.] ====================================== void foo(typedef x[]) {} ====================================== ICE in pop_binding, at cp/name-lookup.c:380 ====================================== template<typedef> void foo(); void bar() { foo<int>(); } ====================================== ICE in instantiate_decl, at cp/pt.c:11703 ====================================== template<typedef,int> struct A; ====================================== tree check ICE: expected template_type_parm or template_template_parm or bound_template_template_parm, have integer_type in process_template_parm, at cp/pt.c:2336 ====================================== template<typedef> struct A { void foo(); void bar(); }; A<int> a; ====================================== ICE in finish_member_declaration, at cp/semantics.c:2212 ====================================== template<typedef> struct A { friend void foo(); }; A<int> a; ====================================== ICE in tsubst_decl, at cp/pt.c:6263 Some of these examples crash since GCC 2.95.3, but some (like the first and last) since 3.4.0, so this is a regression. Patch to follow. -- Summary: [4.0/4.1/4.2 regression] ICE on typedef in parameter declaration 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=27572