| 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 |
int |
| 26 |
main() { |
| 27 |
try { |
| 28 |
try { |
| 29 |
throw 1; |
| 30 |
} catch (int i) { |
| 31 |
A a; // A hit on this EH dtor went to the wrong place |
| 32 |
throw 1; |
| 33 |
} |
| 34 |
} catch (...) { |
| 35 |
return 1; |
| 36 |
} |
| 37 |
return 1; |
| 38 |
} |