FSF GCC merge 02/23/03
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.eh / spec1.C
blob044af8cdb9b2e2ac6d0330329cd42f1ab2a043fe
1 // Testing exception specifications.
2 // Test 1: the original exception succeeds.
4 #include <stdlib.h>
5 #include <exception>
7 void my_term ()  { exit (1); }
8 void my_unexp () { throw 42; }
10 void
11 f () throw (char, int, std::bad_exception)
13   throw 'a';
16 int main ()
18   std::set_terminate (my_term);
19   std::set_unexpected (my_unexp);
21   try
22     {
23       f ();
24     }
25   catch (char)
26     {
27       return 0;
28     }
29   catch (int)
30     {
31       return 3;
32     }
33   catch (std::bad_exception)
34     {
35       return 4;
36     }
37   return 5;