Resolution of B-2 not reflected in B-6 (aka covariant returns)
Jason Merrill
jason at cygnus.com
Thu Mar 9 09:37:17 UTC 2000
>>>>> Jim Dehnert <dehnert at baalbek.engr.sgi.com> writes:
> I think this can be dealt with by the following rule:
> The adjusting entrypoints referenced by vtable entries in secondary
> vtables must adjust both the this pointer and the covariant return
> pointer (if necessary). If a derived class and its primary base
> share a vtable, and the derived class overrides a virtual function in
> the primary base's primary vtable with a different return type, then
> the shared vtable entry adjusts the return type to that required by
> the base class, and a second entry is allocated in the derived type's
> vtable (according to the position rules for any vfunc added by the
> derived class) for the overriding function, which adjusts neither
> this nor the return type.
> Note that this rule does not provide what I originally assumed was
> meant by "multiple entries for covariant returns," as it makes use of
> the multiple entries already present in secondary vtables when it can.
I think that is what was meant. To restate:
When a virtual function is declared in a class, it gets a new vtable slot
unless it overrides a function from the primary base and conversion
between the two return types does not require an adjustment.
It seems unnecessary to force a new entry if the return types are related
by single inheritance.
Jason
More information about the cxx-abi-dev
mailing list