blob: 044af8cdb9b2e2ac6d0330329cd42f1ab2a043fe (
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
|
// Testing exception specifications.
// Test 1: the original exception succeeds.
#include <stdlib.h>
#include <exception>
void my_term () { exit (1); }
void my_unexp () { throw 42; }
void
f () throw (char, int, std::bad_exception)
{
throw 'a';
}
int main ()
{
std::set_terminate (my_term);
std::set_unexpected (my_unexp);
try
{
f ();
}
catch (char)
{
return 0;
}
catch (int)
{
return 3;
}
catch (std::bad_exception)
{
return 4;
}
return 5;
}
|