3 // Copyright (C) 2001 Free Software Foundation, Inc.
4 // Contributed by Nathan Sidwell 12 Apr 2001 <nathan@codesourcery.com>
6 // Check we deal with trailing empty base classes properly
20 virtual void Foo () {}
24 virtual void Foo () {}
26 struct C3 : B1, B2, B3
28 virtual void Foo () {}
30 struct C4 : B1, B2, B3, B4
32 virtual void Foo () {}
34 struct C5 : B1, B2, B3, B4, B5
36 virtual void Foo () {}
38 struct C6 : B1, B2, B3, B4, B5, B6
40 virtual void Foo () {}
42 struct C7 : B1, B2, B3, B4, B5, B6, B7
44 virtual void Foo () {}
46 struct C8 : B1, B2, B3, B4, B5, B6, B7, B8
48 virtual void Foo () {}
51 struct D1 : virtual C1 {};
52 struct D2 : virtual C2 {};
53 struct D3 : virtual C3 {};
54 struct D4 : virtual C4 {};
55 struct D5 : virtual C5 {};
56 struct D6 : virtual C6 {};
57 struct D7 : virtual C7 {};
58 struct D8 : virtual C8 {};
60 unsigned const nearly_empty_size = sizeof (D1);
62 template <typename Cn, typename Dn> int Check (Dn const &ref)
64 if ((sizeof (Cn) <= nearly_empty_size)
65 != (static_cast <void const *> (&ref)
66 == static_cast <Cn const *> (&ref)))
71 template <typename Bn, typename Cn> int Check ()
75 if (static_cast <A *> (static_cast <B1 *> (&c[1]))
76 == static_cast <A *> (static_cast <Bn *> (&c[0])))
84 #if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
102 if (Check<C1> (D1 ()))
104 if (Check<C2> (D2 ()))
106 if (Check<C3> (D3 ()))
108 if (Check<C4> (D4 ()))
110 if (Check<C5> (D5 ()))
112 if (Check<C6> (D6 ()))
114 if (Check<C7> (D7 ()))
116 if (Check<C8> (D8 ()))
119 if (sizeof (C2) == nearly_empty_size)
121 if (sizeof (C3) == nearly_empty_size)
123 if (sizeof (C4) == nearly_empty_size)
125 if (sizeof (C5) == nearly_empty_size)
127 if (sizeof (C6) == nearly_empty_size)
129 if (sizeof (C7) == nearly_empty_size)
131 if (sizeof (C8) == nearly_empty_size)