repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git]
/
gcc
/
testsuite
/
g++.old-deja
/
g++.eh
/
spec4.C
blob
e1f702e20392f71423780cea03265e2169baae97
1
// { dg-do run }
2
// Testing exception specifications.
3
// Test 4: all throws fail, call terminate.
4
5
#include <stdlib.h>
6
#include <exception>
7
8
void my_term () { exit (0); }
9
void my_unexp () { throw 42; }
10
11
void
12
f () throw (short)
13
{
14
throw 'a';
15
}
16
17
int main ()
18
{
19
std::set_terminate (my_term);
20
std::set_unexpected (my_unexp);
21
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;
39
}