This commit was manufactured by cvs2svn to create branch
[official-gcc.git] / gcc / testsuite / g++.dg / eh / forced4.C
blob88b48c82b0a44a2c6bbaf4dc359bccbc3e360202
1 // HP-UX libunwind.so doesn't provide _Unwind_ForcedUnwind.
2 // { dg-do run { xfail "ia64-hp-hpux11.*" } }
4 // Test that forced unwinding does not call std::unexpected going 
5 // throw a function with a non-empty exception spec.
7 #include <unwind.h>
8 #include <stdlib.h>
10 static _Unwind_Reason_Code
11 force_unwind_stop (int version, _Unwind_Action actions,
12                    _Unwind_Exception_Class exc_class,
13                    struct _Unwind_Exception *exc_obj,
14                    struct _Unwind_Context *context,
15                    void *stop_parameter)
17   if (actions & _UA_END_OF_STACK)
18     abort ();
19   return _URC_NO_REASON;
22 static void __attribute__((noreturn))
23 force_unwind ()
25   _Unwind_Exception *exc = new _Unwind_Exception;
26   exc->exception_class = 0;
27   exc->exception_cleanup = 0;
29 #ifndef __USING_SJLJ_EXCEPTIONS__
30   _Unwind_ForcedUnwind (exc, force_unwind_stop, 0);
31 #else
32   _Unwind_SjLj_ForcedUnwind (exc, force_unwind_stop, 0);
33 #endif
35   abort ();
38 static void
39 doit () throw(int)
41   force_unwind ();
44 int main()
45
46   try {
47     doit ();
48   } catch (...) {
49   }