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]

Re: [patch] Fix PR c++/22604, ICE after invalid covariant return


Volker Reichelt wrote:
Consider the following testcase:

struct A;

  struct B
  {
    virtual A* foo();  // { dg-error "overriding" }
  };

  struct C : B
  {
    virtual C* foo();  // { dg-error "invalid covariant" }
  };

The declaration of foo in struct C is invalid.
When updating the vtable for C the compiler fails to check for invalid
overriders in update_vtable_entry_for_fn, thus causing an ICE.

What about making foo non-virtual when the error occurs? If that's hard, your patch is OK.


--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304


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