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.
Subject: Bug number PR c++/27572 A patch for this bug has been added to the patch tracker. The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-05/msg00502.html
Subject: Bug number PR c++/27572 A patch for this bug has been added to the patch tracker. The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-07/msg01036.html
Subject: Bug 27572 Author: reichelt Date: Tue Jul 25 00:57:10 2006 New Revision: 115729 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115729 Log: PR c++/27572 * decl.c (grokdeclarator): Return error_mark_node after invalid typedef. * g++.dg/other/typedef1.C: New test. * g++.dg/template/typedef4.C: New test. * g++.dg/template/typedef5.C: New test. Added: trunk/gcc/testsuite/g++.dg/other/typedef1.C trunk/gcc/testsuite/g++.dg/template/typedef4.C trunk/gcc/testsuite/g++.dg/template/typedef5.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/decl.c trunk/gcc/testsuite/ChangeLog
Subject: Bug 27572 Author: reichelt Date: Tue Jul 25 01:02:08 2006 New Revision: 115730 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115730 Log: PR c++/27572 * decl.c (grokdeclarator): Return error_mark_node after invalid typedef. * g++.dg/other/typedef1.C: New test. * g++.dg/template/typedef4.C: New test. * g++.dg/template/typedef5.C: New test. Added: branches/gcc-4_1-branch/gcc/testsuite/g++.dg/other/typedef1.C branches/gcc-4_1-branch/gcc/testsuite/g++.dg/template/typedef4.C branches/gcc-4_1-branch/gcc/testsuite/g++.dg/template/typedef5.C Modified: branches/gcc-4_1-branch/gcc/cp/ChangeLog branches/gcc-4_1-branch/gcc/cp/decl.c branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
Subject: Bug 27572 Author: reichelt Date: Tue Jul 25 01:06:15 2006 New Revision: 115731 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115731 Log: PR c++/27572 * decl.c (grokdeclarator): Return error_mark_node after invalid typedef. * g++.dg/other/typedef1.C: New test. * g++.dg/template/typedef4.C: New test. * g++.dg/template/typedef5.C: New test. Added: branches/gcc-4_0-branch/gcc/testsuite/g++.dg/other/typedef1.C branches/gcc-4_0-branch/gcc/testsuite/g++.dg/template/typedef4.C branches/gcc-4_0-branch/gcc/testsuite/g++.dg/template/typedef5.C Modified: branches/gcc-4_0-branch/gcc/cp/ChangeLog branches/gcc-4_0-branch/gcc/cp/decl.c branches/gcc-4_0-branch/gcc/testsuite/ChangeLog
Fixed on mainline, 4.1 branch, and 4.0 branch. Some of the testcases still crash, but they crash in get_innermost_template_args. This problem is tracked in PR 27397.