This is the mail archive of the gcc@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: covariant returns


Stefan Seefeld wrote:

> sorry, not implemented: adjusting pointers for covariant returns

> However, I'm unable to reproduce that problem in
> a simplified example. Could anybody please explain
> under what conditions covariant return types are/are not
> supported ?
g++ currently (both 2.95 & 3.0 series) supports only trivial covariance.

This means that the class named in the return type of the overridden
virtual function must be at offset zero in the derived class named in
the return type of the overriding virtual function.  This is true for
non-virtual single inheritance[1], and for the first non-virtual base
in multiple inheritance[2]

nathan

[1] This is a lie in the new ABI. An exception is that if the base is
non-polymorphic and the derived class is polymorphic, the base will not
be at offset zero.

[2] This too is a lie in the new ABI.  [1] applies. Also if the base
is non-polymorphic & without virtual bases, but the derived class is
non-polymorphic but contains virtual bases, then the first non-virtual base
will not be at offset zero.

-- 
Dr Nathan Sidwell   ::   http://www.codesourcery.com   ::   CodeSourcery LLC
         'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org


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