re PR c++/27492 (ICE on invalid covariant return type)

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.

From-SVN: r121089
This commit is contained in:
Simon Martin 2007-01-23 22:33:51 +00:00 committed by Simon Martin
parent a99e5cb4d8
commit 815951d8f0
4 changed files with 30 additions and 0 deletions

View File

@ -1,3 +1,9 @@
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.
2007-01-23 Ian Lance Taylor <iant@google.com>
* typeck.c (convert_for_assignment): Only warn about a = b = c

View File

@ -1576,6 +1576,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
DECL_STATIC_DESTRUCTOR (newdecl) |= DECL_STATIC_DESTRUCTOR (olddecl);
DECL_PURE_VIRTUAL_P (newdecl) |= DECL_PURE_VIRTUAL_P (olddecl);
DECL_VIRTUAL_P (newdecl) |= DECL_VIRTUAL_P (olddecl);
DECL_INVALID_OVERRIDER_P (newdecl) |= DECL_INVALID_OVERRIDER_P (olddecl);
DECL_THIS_STATIC (newdecl) |= DECL_THIS_STATIC (olddecl);
if (DECL_OVERLOADED_OPERATOR_P (olddecl) != ERROR_MARK)
SET_OVERLOADED_OPERATOR_CODE

View File

@ -1,3 +1,8 @@
2007-01-23 Simon Martin <simartin@users.sourceforge.net>
PR c++/27492
* g++.dg/inherit/covariant15.C: New test.
2007-01-23 Ian Lance Taylor <iant@google.com>
* g++.dg/warn/Wparentheses-24.C: New test.

View File

@ -0,0 +1,18 @@
/* This used to ICE (PR c++/27492) */
/* { dg-do "compile" } */
struct A {};
class B : A
{
virtual A* foo(); /* { dg-error "overriding" } */
};
struct C : virtual B
{
virtual C* foo(); /* { dg-error "invalid covariant return type" } */
};
C* C::foo() { return 0; }
struct D : C {};