FSF GCC merge 02/23/03
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.robertl / eh990323-2.C
blobd672814ba19cc8ac26e1f40e662710b106867642
1 // check MI and VBC offsets on throw
2 extern "C" void abort ();
3 extern "C" void exit (int);
5 struct A {
6         int x[23];
7 };
9 struct B : virtual public A {
10         int y[33];
13 struct C : virtual public A, public B {
14         int z[43];
17 struct D {
18         int xx[53];
21 struct E : public D, public A {
22         int yy[63];
25 C c;
27 E e;
29 void f1()
31         throw (C*)0;
34 void f2()
36         throw &c;
39 void f3()
41         throw (E*)0;
44 void f4()
46         throw &e;
49 int main()
51         int flag;
53         flag = 0;
54         try {
55                 f1();
56         }
57         catch (A* p) {
58                 if (p)
59                         abort();
60                 flag = 1;
61         }
62         if (!flag)
63                 abort();
65         flag = 0;
66         try {
67                 f2();
68         }
69         catch (A* p) {
70                 if (!p || (void*)p == (void*)&c)
71                         abort();
72                 flag = 1;
73         }
74         if (!flag)
75                 abort();
77         flag = 0;
78         try {
79                 f3();
80         }
81         catch (A* p) {
82                 if (p)
83                         abort();
84                 flag = 1;
85         }
86         if (!flag)
87                 abort();
89         flag = 0;
90         try {
91                 f4();
92         }
93         catch (A* p) {
94                 if (!p || (void*)p == (void*)&e)
95                         abort();
96                 flag = 1;
97         }
98         if (!flag)
99                 abort();
101         exit(0);