FSF GCC merge 02/23/03
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.eh / rethrow3.C
blob5ab25d66fd41e46f8df17c9a7d5c288a50933595
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <exception>
5 static void
6 eh_terminate ()
8   printf ("CALLING TERMINATE\n");
9   exit (1);
12 void
13 eh_test (int level)
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);
30       if (level > 0)
31         throw;
32     }
35 int main ()
37   std::set_terminate (&eh_terminate);
38   eh_test (0);