Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/g++.old-deja/g++.mike/eh25.C @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children | 84e7813d76e9 |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 // { dg-do run { xfail sparc64-*-elf arm-*-pe } } | |
2 // { dg-options "-fexceptions" } | |
3 | |
4 #include <exception> | |
5 #include <stdlib.h> | |
6 | |
7 void my_terminate() { | |
8 exit (0); // Double faults should call terminate | |
9 } | |
10 | |
11 struct A { | |
12 A() { } | |
13 ~A() | |
14 #if __cplusplus <= 201402L | |
15 throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++17 } } } } | |
16 #else | |
17 noexcept(false) | |
18 #endif | |
19 { | |
20 std::set_terminate (my_terminate); | |
21 throw 1; // This throws from EH dtor, should call my_terminate | |
22 } | |
23 }; | |
24 | |
25 main() { | |
26 try { | |
27 try { | |
28 throw 1; | |
29 } catch (int i) { | |
30 A a; // A hit on this EH dtor went to the wrong place | |
31 throw 1; | |
32 } | |
33 } catch (...) { | |
34 return 1; | |
35 } | |
36 return 1; | |
37 } |