Bug 27492 - [4.1 regression] ICE on invalid covariant return type
Summary: [4.1 regression] ICE on invalid covariant return type
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.2.0
: P4 minor
Target Milestone: 4.2.1
Assignee: Simon Martin
URL:
Keywords: error-recovery, ice-on-invalid-code, monitored
Depends on:
Blocks:
 
Reported: 2006-05-08 15:17 UTC by Volker Reichelt
Modified: 2008-07-04 15:30 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.2.1
Known to fail: 4.0.4 4.1.3 4.2.0
Last reconfirmed: 2007-01-12 22:57:44


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2006-05-08 15:17:42 UTC
The following invalid code snippet causes an ICE since GCC 4.0.3:

=================================
struct A {};

class B : A
{
    virtual A* foo();
};

struct C : virtual B
{
    virtual C* foo();
};

C* C::foo() { return 0; }

struct D : C {};
=================================

bug.cc:10: error: invalid covariant return type for 'virtual C* C::foo()'
bug.cc:5: error:   overriding 'virtual A* B::foo()'
bug.cc:15: internal compiler error: in make_thunk, at cp/method.c:129
Please submit a full bug report, [etc.]
Comment 1 Andrew Pinski 2006-05-09 16:35:50 UTC
Confirmed.
Comment 2 Mark Mitchell 2006-05-25 02:34:48 UTC
Will not be fixed in 4.1.1; adjust target milestone to 4.1.2.
Comment 3 Simon Martin 2007-01-12 22:57:44 UTC
I am testing a patch for this one.
Comment 4 patchapp@dberlin.org 2007-01-16 00:57:01 UTC
Subject: Bug number PR c++/27492

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/2007-01/msg01124.html
Comment 5 Simon Martin 2007-01-23 22:34:03 UTC
Subject: Bug 27492

Author: simartin
Date: Tue Jan 23 22:33:51 2007
New Revision: 121089

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=121089
Log:
2007-01-23  Simon Martin  <simartin@users.sourceforge.net>

	PR c++/27492
	* decl.c (duplicate_decls): Don't reset DECL_INVALID_OVERRIDER_P for
	function decls.

Added:
    trunk/gcc/testsuite/g++.dg/inherit/covariant15.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/testsuite/ChangeLog

Comment 6 Simon Martin 2007-01-24 18:43:21 UTC
Fixed on the mainline
Comment 7 Simon Martin 2007-06-27 19:53:57 UTC
Subject: Bug 27492

Author: simartin
Date: Wed Jun 27 19:53:45 2007
New Revision: 126061

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126061
Log:
gcc/cp/

2007-06-27  Simon Martin  <simartin@users.sourceforge.net>
        
	PR c++/27492
	* decl.c (duplicate_decls): Don't reset DECL_INVALID_OVERRIDER_P for
	function decls.

gcc/testsuite/

2007-06-27  Simon Martin  <simartin@users.sourceforge.net>

	PR c++/27492
	* g++.dg/inherit/covariant15.C: New test.

Added:
    branches/gcc-4_2-branch/gcc/testsuite/g++.dg/inherit/covariant15.C
Modified:
    branches/gcc-4_2-branch/gcc/cp/ChangeLog
    branches/gcc-4_2-branch/gcc/cp/decl.c
    branches/gcc-4_2-branch/gcc/testsuite/ChangeLog

Comment 8 Simon Martin 2007-06-27 19:59:44 UTC
Fixed in 4.2 as well.
Comment 9 Joseph S. Myers 2008-07-04 15:30:53 UTC
Closing 4.1 branch.