vtable layout

Jason Merrill jason at cygnus.com
Mon Aug 30 18:09:02 UTC 1999


>>>>> thomson  <thomson at ca.ibm.com> writes:

 > I don't see how this solves my diamond case

 >    struct V1 { virtual void f();  virtual void g(); };
 >    struct Other1 { virtual void ignore1(); }
 >    struct X : Other1, virtual V1 { virtual void f(); }

 >    struct Y : Other1, virtual V1 { virtual void g(); }

 >    struct ZZ: X, Y {}

You're right, I didn't think it through far enough.  On the sides of the
diamonds, we decide where the adjustments go.  They end up in the first
available slot, which is slot -1 in both classes.  But only one adjustment
can be at that offset from the V1 vptr, so the adjustments from V1 to X and
Y must be identical.  Which they're not, so this doesn't work.  It gets
worse if the two classes have different numbers of virtual functions.

Christophe?

Jason




More information about the cxx-abi-dev mailing list