In ChangeLog: 2001-11-08 Geoffrey Keating <geoffk@redhat.com>
[gcc.git] / gcc / testsuite / g++.old-deja / g++.eh / rethrow3.C
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <exception>
4
5 static void
6 eh_terminate ()
7 {
8 printf ("CALLING TERMINATE\n");
9 exit (1);
10 }
11
12 void
13 eh_test (int level)
14 {
15 try
16 {
17 if (level < 2)
18 eh_test (level + 1);
19 else
20 {
21 printf ("%d: Throwing\n", level);
22 throw (level);
23 }
24 }
25 catch (int &x)
26 {
27 printf ("%d: Got level %d\n",
28 level, x);
29
30 if (level > 0)
31 throw;
32 }
33 }
34
35 int main ()
36 {
37 std::set_terminate (&eh_terminate);
38 eh_test (0);
39 }