Wattributes-10.c: Add -fno-common option on hppa*-*-hpux*.
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.eh / spec4.C
blobe102239ed89dd37baef7d928c6afc809a43b6bd2
1 // { dg-do run { target c++14_down } }
2 // Testing exception specifications.
3 // Test 4: all throws fail, call terminate.
5 #include <stdlib.h>
6 #include <exception>
8 void my_term ()  { exit (0); }
9 void my_unexp () { throw 42; }
11 void
12 f () throw (short)              // { dg-warning "deprecated" "" { target c++11 } }
14   throw 'a';
17 int main ()
19   std::set_terminate (my_term);
20   std::set_unexpected (my_unexp);
22   try
23     {
24       f ();
25     }
26   catch (char)
27     {
28       return 2;
29     }
30   catch (int)
31     {
32       return 3;
33     }
34   catch (std::bad_exception)
35     {
36       return 4;
37     }
38   return 5;