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

Mark Mitchell mark@codesourcery.com
Fri Aug 5 23:21:00 GMT 2005


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



More information about the Gcc-patches mailing list