This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 4.1/4.2] Backport of the fix for PR c++/27492


Hi all.

Here's a patch to backport the fix for PR c++/27492 into the 4.1 and 4.2 
branches. It is exactly the same as the initial one, submitted here:
  http://gcc.gnu.org/ml/gcc-patches/2007-01/msg01124.html
and approved here:
  http://gcc.gnu.org/ml/gcc-patches/2007-01/msg01851.html

I have successfully regtested it on i686-pc-linux-gnu on 4.1 and 4.2. Is it OK 
for both branches?

Best regards,
Simon
2007-03-09  Simon Martin  <simartin@users.sourceforge.net>

	PR c++/27492
	* decl.c (duplicate_decls): Don't reset DECL_INVALID_OVERRIDER_P for
	function decls.
Index: gcc/cp/decl.c
===================================================================
--- gcc/cp/decl.c	(revision 120735)
+++ gcc/cp/decl.c	(working copy)
@@ -1576,6 +1576,7 @@ duplicate_decls (tree newdecl, tree oldd
       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
2007-03-09  Simon Martin  <simartin@users.sourceforge.net>

	PR c++/27492
	* g++.dg/inherit/covariant15.C: New test.
/* 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 {};

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]