1 // Test various aspects of vtable layout.
2 // Special g++ Options: -fno-strict-aliasing
3 // Origin: Mark Mitchell <mark@codesourcery.com>
5 #if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
26 struct S2 : virtual public S0
44 struct S4 : public virtual S1, public S2, public S3
48 inline void* vtable (void *object)
50 // The vptr is always the first part of the object.
51 return * (void **) object;
56 // The vtable layout order for S4 should consist of S4's primary
57 // vtable (shared with S2), followed by the vtable for S3 (because
58 // it is a non-virtual base). Then, these should be followed by the
59 // the vtables for S1 and S0, which are virtual.
66 if (vtable (&s4) != vtable (s2))
68 if (vtable (s2) >= vtable (s3))
70 if (vtable (s3) >= vtable (s1))
72 if (vtable (s1) >= vtable (s0))
76 #else /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */
82 #endif /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */