RISC-V: Fix rtl checking enabled failure with -msave-restore.
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.mike / eh25.C
blob6516494dd44213c2d3d6b7bb5b6b1cc5b6f14a70
1 // { dg-do run { xfail sparc64-*-elf arm-*-pe } }
2 // { dg-options "-fexceptions" }
4 #include <exception>
5 #include <stdlib.h>
7 void my_terminate() {
8   exit (0);             // Double faults should call terminate
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   }
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;