Why don't we just FIX the damn vthunk problem?

Martin v. Loewis martin@mira.isdn.cs.tu-berlin.de
Mon Mar 1 15:18:00 GMT 1999


> Not necessarily.  We could set up the [cd]tor vtables in the code
> controlled by the in_chrg parameter, where we actually run the vbase
> [cd]tors.  Then the vbase ctors themselves would wait to set their own
> vtables until the end of the function.

I'm not sure I understand this approach. Consider

class A{virtual void foo();};

class B:virtual A{void foo();};

class C:public B{
  int dummy;
  void foo();
};

When constructing a C instance, the B base constructor needs a vtable
that is only used inside B::B, and only when constructing C instances.
So if you want to statically allocate it, how does B::B know which
table to use, unless C::C passes it as a parameter?

Martin


More information about the Gcc-bugs mailing list