Vbase offsets

Mark Mitchell mark at codesourcery.com
Tue Apr 4 03:35:08 UTC 2000


We have:

  There is one virtual base offset entry for each direct virtual base
  class, and one for each indirect virtual base class inherited via a
  direct virtual base class. (Indirect virtual base classes inherited
  via direct non-virtual base classes may be accessed via the the offset
  stored in the base's vtable.) If an indirect virtual base class is
  inherited via both virtual and non-virtual direct base classes, no
  virtual base offset entry is included for it.

That seems to imply that a *direct* virtual base gets a new vbase
offset, even it is also a direct virtual vbase of a direct non-virtual
base. 

Example:

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

The language quoted seems to imply that `U' gets a vbase offset for
`S'.  But, that seems unncessary: we already have one in `T's vtable.
(Even if T were not the primary base, because it is a non-virtual
base, we know where to find the offset, give a `U*'.)

Am I missing something?

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




More information about the cxx-abi-dev mailing list