Bug 27309 - [4.1 regression] ICE on invalid constructor definition
Summary: [4.1 regression] ICE on invalid constructor definition
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.2.0
: P2 minor
Target Milestone: 4.2.0
Assignee: Mark Mitchell
URL:
Keywords: error-recovery, ice-on-invalid-code, monitored
: 27379 27380 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-04-25 13:17 UTC by Volker Reichelt
Modified: 2008-07-04 15:29 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.2.0
Known to fail: 4.0.4 4.1.3
Last reconfirmed: 2006-09-03 21:39:55


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2006-04-25 13:17:58 UTC
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.
Comment 1 Andrew Pinski 2006-04-25 21:32:58 UTC
Confirmed.
Comment 2 Mark Mitchell 2006-05-02 15:59:54 UTC
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

Comment 3 Mark Mitchell 2006-05-02 16:23:12 UTC
Fixed in 4.2.0.
Comment 4 Volker Reichelt 2006-05-03 10:34:05 UTC
*** Bug 27379 has been marked as a duplicate of this bug. ***
Comment 5 Volker Reichelt 2006-05-03 10:35:21 UTC
*** Bug 27380 has been marked as a duplicate of this bug. ***
Comment 6 Volker Reichelt 2006-05-03 10:38:19 UTC
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?
Comment 7 Mark Mitchell 2006-05-03 14:51:39 UTC
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.

Comment 8 Mark Mitchell 2006-05-25 02:34:40 UTC
Will not be fixed in 4.1.1; adjust target milestone to 4.1.2.
Comment 9 Joseph S. Myers 2008-07-04 15:29:27 UTC
Closing 4.1 branch.