2 // Copyright (C) 2000 Free Software Foundation, Inc.
3 // Contributed by Nathan Sidwell 16 Jan 2001 <nathan@codesourcery.com>
5 // Bug 1611. Under the new ABI, the vtable can be clobbered during dtoring our
6 // primary vbase. We mustn't use the vtable after that to locate our vbases.
8 #if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
14 int *ctorVDerived = 0;
15 int *dtorVDerived = 0;
24 if (ctorVBase) exit (1);
29 if (dtorVBase) exit (2);
31 if (dtorVBase != ctorVBase) exit (3);
36 printf (" VBase::member %d\n", &this->VBase::member - (int *)this);
40 struct VDerived : virtual VBase
46 if (ctorVDerived) exit (4);
47 ctorVDerived = &member;
51 if (dtorVDerived) exit (5);
52 dtorVDerived = &member;
53 if (dtorVDerived != ctorVDerived) exit (6);
57 printf ("VDerived\n");
58 printf (" VBase::member %d\n", &this->VBase::member - (int *)this);
59 printf (" VDerived::member %d\n", &this->VDerived::member - (int *)this);
62 struct B : virtual VBase
68 printf (" VBase::member %d\n", &this->VBase::member - (int *)this);
69 printf (" B::member %d\n", &this->B::member - (int *)this);
72 struct MostDerived : B, virtual VDerived
77 printf ("MostDerived\n");
78 printf (" VBase::member %d\n", &this->VBase::member - (int *)this);
79 printf (" B::member %d\n", &this->B::member - (int *)this);
80 printf (" VDerived::member %d\n", &this->VDerived::member - (int *)this);
81 printf (" MostDerived::member %d\n", &this->MostDerived::member - (int *)this);
91 int *this_ = (int *)&dum;
93 if (ctorVBase != &dum.VBase::member)
95 if (ctorVDerived != &dum.VDerived::member)
98 printf (" VBase::member %d\n", &dum.VBase::member - this_);
99 printf (" B::member %d\n", &dum.B::member - this_);
100 printf (" VDerived::member %d\n", &dum.VDerived::member - this_);
101 printf (" MostDerived::member %d\n", &dum.MostDerived::member - this_);
102 dum.MostDerived::Offset ();
104 dum.VDerived::Offset ();
105 dum.VBase::Offset ();
109 #else /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */
115 #endif /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */