2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.robertl / eh990323-4.C
blob24c740dd1ddec2adf9fdadab3a64a9a4f9a673bc
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
51 main()
53         int flag;
55         flag = 0;
56         try {
57                 f1();
58         }
59         catch (void* p) {
60                 if (p)
61                         abort();
62                 flag = 1;
63         }
64         if (!flag)
65                 abort();
67         flag = 0;
68         try {
69                 f2();
70         }
71         catch (void* p) {
72                 if (!p || (void*)p != (void*)&c)
73                         abort();
74                 flag = 1;
75         }
76         if (!flag)
77                 abort();
79         flag = 0;
80         try {
81                 f3();
82         }
83         catch (void* p) {
84                 if (p)
85                         abort();
86                 flag = 1;
87         }
88         if (!flag)
89                 abort();
91         flag = 0;
92         try {
93                 f4();
94         }
95         catch (void* p) {
96                 if (!p || (void*)p != (void*)&e)
97                         abort();
98                 flag = 1;
99         }
100         if (!flag)
101                 abort();
103         exit(0);