Emptyness vs. virtualness

Jim Dehnert dehnert at transmeta.com
Thu Mar 22 01:12:17 UTC 2001


Jason Merrill wrote:
> 
> >>>>> "Mark" == Mark Mitchell <mark at codesourcery.com> writes:
> 
> >   struct A {};
> 
> >   struct B : public A {
> >     virtual void f () {}
> >   };
> 
> >   struct C : public virtual B {};
> 
> >   struct A2 : public A {};
> 
> >   struct D : public C, public A2 {
> >   };
> 
> > Clearly C goes at offset 0.  Now, can A2 go at offset 0?
> 
> > We have a disagreement between two of our implementations; I'm trying
> > to figure out if we actually decided this before or not.  Does anyone
> > recall any traffic about this?
> 
> I don't.  My inclination would be to say that A2 cannot be at offset 0;
> otherwise we would have to add a new B subobject for D.

But that's what I would have expected.  The rule is that we first lay out
the non-virtual things (C (not B), A2 (with A)) and then all the virtual
bases (B).  By the time we get to B, it's A can't be at 0, so we get a new
one.

Jim
-- 
		Jim Dehnert		Transmeta Corp.
		dehnert at transmeta.com	(408) 919-6984
		dehnertj at acm.org




More information about the cxx-abi-dev mailing list