[cfe-dev] Microsoft vtordisp field support for clang.
r4start
r4start at gmail.com
Tue Feb 14 03:40:48 PST 2012
On 14/02/2012 15:34, r4start wrote:
> On 14/02/2012 05:06, John McCall wrote:
>> class A { virtual void foo(); } class B : public A { }; class C :
>> public virtual B { C(); virtual void foo(); };
> For this test we will get next result:
> class C size(12):
> +---
> 0 | {vbptr}
> +---
> 4 | (vtordisp for vbase B)
> +--- (virtual base B)
> | +--- (base class A)
> 8 | | {vfptr}
> | +---
> +---
> If somewhere in inheritance path class has declare ctor or dtor and
> overload virtual method from virtual base,
> then before virtual base Microsoft compiler push vtordisp in layout.
>
Also for this test case:
class A { virtual void foo(){} };
class B : public A { };
class C : public virtual B { C(){} virtual void foo(){} };
class D : public C { int qqq; };
class D size(16):
+---
| +--- (base class C)
0 | | {vbptr}
| +---
4 | qqq
+---
8 | (vtordisp for vbase B)
+--- (virtual base B)
| +--- (base class A)
12 | | {vfptr}
| +---
+---
As you can see D also has vtordisp for B.
- Dmitry.
More information about the cfe-dev
mailing list