OSDN Git Service

* init.c (expand_aggr_vbase_init): Rename to
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.old-deja / g++.eh / rethrow5.C
1 // Testcase for proper handling of rethrow.
2
3 #include <stdio.h>
4
5 int c, d;
6
7 struct A
8 {
9   int i;
10   A () { i = ++c; printf ("A() %d\n", i); }
11   A (const A&) { i = ++c; printf ("A(const A&) %d\n", i); }
12   ~A() { printf ("~A() %d\n", i); ++d; }
13 };
14
15 int
16 main ()
17 {
18   try
19     {
20       try
21         {
22           printf ("Throwing 1...\n");
23           throw A();
24         }
25       catch (A)
26         {
27           try
28             {
29               printf ("Throwing 2...\n");
30               throw;
31             }
32           catch (A)
33             {
34               printf ("Falling out...\n");
35             }
36         }
37     }
38   catch (A)
39     {
40       printf ("Caught.\n");
41     }
42   printf ("c == %d, d == %d\n", c, d);
43   return c != d;
44 }