1 // PR c++/48035
2 // { dg-do run }
3 
4 #include <new>
5 #include <cstring>
6 #include <cstdlib>
7 
8 struct A
9 {
fooA10   virtual void foo (void) {}
~AA11   virtual ~A () {}
12 };
13 
14 struct B : public A
15 {
~BB16   virtual ~B () {}
17 };
18 
19 struct C
20 {
~CC21   virtual ~C () {}
22   int c;
23 };
24 
25 struct D : public virtual B, public C
26 {
~DD27   virtual ~D () {}
28 };
29 
30 struct E : public virtual D
31 {
~EE32   virtual ~E () {}
33 };
34 
35 int
main()36 main ()
37 {
38   char *v = new char[sizeof (E) + 16];
39   memset (v, 0x55, sizeof (E) + 16);
40   E *e = new (v) E ();
41   e->~E ();
42 
43   for (unsigned i = sizeof (E); i < sizeof (E) + 16; ++i)
44     if (v[i] != 0x55)
45       abort ();
46 
47   delete[] v;
48 }
49