The following invalid testcase causes an ICE since GCC 4.0.0: ================================= struct A { int i; A() i() {} // missing colon }; struct B { A a; }; B b; ================================= bug.cc:4: error: expected ';' before 'i' bug.cc:5: error: expected `;' before '}' token bug.cc:12: internal compiler error: vector VEC(tree,base) index domain error, in locate_ctor at cp/method.c:885 Please submit a full bug report, [etc.] Btw, the code also caused GCC 2.95.x and 3.0.x to crash.
Confirmed.
Subject: Bug 27309 Author: mmitchel Date: Tue May 2 15:59:50 2006 New Revision: 113473 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113473 Log: PR c++/27309 * class.c (add_method): Call grok_special_member_properties. * decl.c (grokdeclarator): Don't call it here. (copy_fn_p): A TEMPLATE_DECL is never a copy constructor or assignment operator. Set TYPE_HAS_CONSTURCTOR if DECL is a constructor. (start_method): Don't call grok_special_member_properties. * method.c (implicitly_declare_fn): Likewise. * pt.c (instantiate_class_template): Likewise. * decl2.c (grokfield): Likewise. PR c++/27309 * g++.dg/parser/ctor5.C: New test. Added: trunk/gcc/testsuite/g++.dg/parse/ctor5.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/class.c trunk/gcc/cp/decl.c trunk/gcc/cp/decl2.c trunk/gcc/cp/method.c trunk/gcc/cp/pt.c trunk/gcc/testsuite/ChangeLog
Fixed in 4.2.0.
*** Bug 27379 has been marked as a duplicate of this bug. ***
*** Bug 27380 has been marked as a duplicate of this bug. ***
Mark, do you want to add some of the testcases from PR27379 and PR27380 to the testsuite as their mode of failure is a little bit different although the underlying problem seems to be the same?
Subject: Re: [4.0/4.1 regression] ICE on invalid constructor definition reichelt at gcc dot gnu dot org wrote: > ------- Comment #6 from reichelt at gcc dot gnu dot org 2006-05-03 10:38 ------- > Mark, do you want to add some of the testcases from PR27379 and PR27380 > to the testsuite as their mode of failure is a little bit different > although the underlying problem seems to be the same? There's certainly no harm in that, but I don't think we'll increase coverage in any interesting way; the underlying cause really was the same for all of those failures.
Will not be fixed in 4.1.1; adjust target milestone to 4.1.2.
Closing 4.1 branch.