Covariant returns?

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Tue Mar 7 11:37:00 GMT 2000


> However, until some such mechanism is implemented, I think the compiler
> should produce an error message rather than incorrect code. 

Now with your example, it seems that this change cannot be implemented
in a backwards-compatible manner. It would result in a new virtual
function, so other virtual functions may change their offsets.  That
could even occur in currently-working code, e.g. if nobody ever uses
the covariant property in a certain application.

The new ABI will address covariant returns correctly, and it will be
quite incompatible with the current ABI. For covariant functions, it
is already specified that a new vtable slot is allocated for each
return type.

Regards,
Martin



More information about the Gcc mailing list