2 // { dg-options "-fno-strict-aliasing" }
3 // Test various aspects of vtable layout.
4 // Origin: Mark Mitchell <mark@codesourcery.com>
6 #if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
27 struct S2 : virtual public S0
45 struct S4 : public virtual S1, public S2, public S3
49 inline void* vtable (void *object)
51 // The vptr is always the first part of the object.
52 return * (void **) object;
57 // The vtable layout order for S4 should consist of S4's primary
58 // vtable (shared with S2), followed by the vtable for S3 (because
59 // it is a non-virtual base). Then, these should be followed by the
60 // the vtables for S1 and S0, which are virtual.
67 if (vtable (&s4) != vtable (s2))
69 if (vtable (s2) >= vtable (s3))
71 if (vtable (s3) >= vtable (s1))
73 if (vtable (s1) >= vtable (s0))
77 #else /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */
83 #endif /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */