diff options
author | YamaArashi <shadow962@live.com> | 2016-01-06 01:47:28 -0800 |
---|---|---|
committer | YamaArashi <shadow962@live.com> | 2016-01-06 01:47:28 -0800 |
commit | be8b04496302184c6e8f04d6179f9c3afc50aeb6 (patch) | |
tree | 726e2468c0c07add773c0dbd86ab6386844259ae /gcc/testsuite/g++.old-deja/g++.eh/spec4.C |
initial commit
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.eh/spec4.C')
-rwxr-xr-x | gcc/testsuite/g++.old-deja/g++.eh/spec4.C | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/spec4.C b/gcc/testsuite/g++.old-deja/g++.eh/spec4.C new file mode 100755 index 0000000..a92f7f0 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.eh/spec4.C @@ -0,0 +1,38 @@ +// 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; +} |