2 // Test to see that primary bases are selected correctly.
3 // Origin: Mark Mitchell <mark@codesourcery.com>
5 #if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
7 // S1 is a nearly-empty base.
16 // S2 is a dynamic, but not nearly-empty, base.
27 // S1 should be the primary base.
29 struct T1 : public S1, public S2
33 // S2 should be the primary base.
35 struct T2 : public S2, public S1
39 // S2 should be the primary base.
41 struct T3 : virtual public S1, public S2
45 // S1 should be the primary base.
47 struct T4 : virtual public S1, virtual public S2
51 // Check that Y is the primary base for X. Otherwise, return N.
52 #define CHECK_PRIMARY_BASE(X, Y, N) \
55 if ((void*) &x != (void *) (Y*) (&x)) \
61 CHECK_PRIMARY_BASE (T1, S1, 1);
62 CHECK_PRIMARY_BASE (T2, S2, 2);
63 CHECK_PRIMARY_BASE (T3, S2, 3);
64 CHECK_PRIMARY_BASE (T4, S1, 4);
67 #else /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */
73 #endif /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */