Another VTT issue

Mark Mitchell mark at codesourcery.com
Fri Dec 22 19:31:46 UTC 2000


In addition to the problem in my last mail, there is an issue with:

  struct S {};
  struct T: virtual S {};
  struct U {};
  struct V: virtual T, virtual U {};

When we construct V, we will first recursively construct T.  As a
result, T's virtual pointer will be set.  Note that T's virtual
pointer and V's virtual pointer are located at the same place.
Therefore, when V's constructor goes to construct U, it cannot find U
by looking at the vbase offset in the vtable.

That means that to find virtual bases during construction you must not
use the vbase offsets in the vtable -- you must instead know the
locations statically.  That works, since you only need to construct
virtual bases when building the complete object, and then you
statically know all offsets.

It would be good if this were mentioned in the ABI document somewhere.

--
Mark Mitchell                   mark at codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com




More information about the cxx-abi-dev mailing list