2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.eh / rethrow3.C
blob952318b80126ce397fe7036ec364aa0e0715751f
1 // { dg-do run  }
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <exception>
6 static void
7 eh_terminate ()
9   printf ("CALLING TERMINATE\n");
10   exit (1);
13 void
14 eh_test (int level)
16   try
17     {
18       if (level < 2)
19         eh_test (level + 1);
20       else
21         {
22           printf ("%d: Throwing\n", level);
23           throw (level);
24         }
25     }
26   catch (int &x)
27     {
28       printf ("%d: Got level %d\n",
29               level, x);
31       if (level > 0)
32         throw;
33     }
36 int main ()
38   std::set_terminate (&eh_terminate);
39   eh_test (0);