blob: e1f702e20392f71423780cea03265e2169baae97 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
// { dg-do run }
// Testing exception specifications.
// Test 4: all throws fail, call terminate.
#include <stdlib.h>
#include <exception>
void my_term () { exit (0); }
void my_unexp () { throw 42; }
void
f () throw (short)
{
throw 'a';
}
int main ()
{
std::set_terminate (my_term);
std::set_unexpected (my_unexp);
try
{
f ();
}
catch (char)
{
return 2;
}
catch (int)
{
return 3;
}
catch (std::bad_exception)
{
return 4;
}
return 5;
}
|