xref: /openbsd-src/gnu/usr.bin/gcc/gcc/testsuite/g++.old-deja/g++.other/vbase1.C (revision dda2819751e49c83612958492e38917049128b41)
1 // Origin: Mark Mitchell <mark@codesourcery.com>
2 // Special g++ Options: -w
3 
4 int result;
5 
6 struct A {
7   A ();
8 
9   int i;
10 };
11 
12 A* ap;
13 
14 A::A ()
15 {
16   ap = this;
17 }
18 
19 struct B : virtual public A
20 {
21   B ();
22   ~B ();
23 
24   int j;
25 };
26 
27 B::B () {
28   if ((A*) this != ap)
29     result = 1;
30 }
31 
32 B::~B () {
33   if ((A*) this != ap)
34     result = 1;
35 }
36 
37 struct C : public B {
38 };
39 
40 struct D : public C, public B
41 {
42 };
43 
44 int main ()
45 {
46   {
47     D d;
48   }
49 
50   return result;
51 }
52