2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.robertl / eh990323-2.C
blob2c2e4bd229394d908b45996ca74b497e1f8f73a1
1 // { dg-do run  }
2 // check MI and VBC offsets on throw
3 extern "C" void abort ();
4 extern "C" void exit (int);
6 struct A {
7         int x[23];
8 };
10 struct B : virtual public A {
11         int y[33];
14 struct C : virtual public A, public B {
15         int z[43];
18 struct D {
19         int xx[53];
22 struct E : public D, public A {
23         int yy[63];
26 C c;
28 E e;
30 void f1()
32         throw (C*)0;
35 void f2()
37         throw &c;
40 void f3()
42         throw (E*)0;
45 void f4()
47         throw &e;
50 int main()
52         int flag;
54         flag = 0;
55         try {
56                 f1();
57         }
58         catch (A* p) {
59                 if (p)
60                         abort();
61                 flag = 1;
62         }
63         if (!flag)
64                 abort();
66         flag = 0;
67         try {
68                 f2();
69         }
70         catch (A* p) {
71                 if (!p || (void*)p == (void*)&c)
72                         abort();
73                 flag = 1;
74         }
75         if (!flag)
76                 abort();
78         flag = 0;
79         try {
80                 f3();
81         }
82         catch (A* p) {
83                 if (p)
84                         abort();
85                 flag = 1;
86         }
87         if (!flag)
88                 abort();
90         flag = 0;
91         try {
92                 f4();
93         }
94         catch (A* p) {
95                 if (!p || (void*)p == (void*)&e)
96                         abort();
97                 flag = 1;
98         }
99         if (!flag)
100                 abort();
102         exit(0);