1 // Runtime test for noexcept-specification.
2 // { dg-options "-std=c++0x" }
20 void f () noexcept (false)
26 void f(T) noexcept (noexcept (T()))
32 void f2(T a) noexcept (noexcept (f (a)))
39 // throw(int) overrides noexcept(false) in either order.
40 void h() throw (int, std::bad_exception);
41 void h() noexcept (false)
46 void i() noexcept (false);
47 void i() throw (int, std::bad_exception)
54 // noexcept(false) allows throw.
55 try { f(); } catch (int) { }
56 // noexcept(noexcept(A())) == noexcept(false).
57 try { f(A()); } catch (int) { }
58 try { f2(A()); } catch (int) { }
60 std::set_unexpected (my_unexpected);
61 try { h(); } catch (std::bad_exception) { }
62 try { i(); } catch (std::bad_exception) { }
64 std::set_terminate (my_terminate);
65 // noexcept(noexcept(int())) == noexcept(true).
66 try { f2(1); } catch (...) { }