1 // Runtime test for noexcept-specification.
2 // { dg-options "-Wnoexcept" }
3 // { dg-do run { target nonpic } }
4 // { dg-require-effective-target c++11 }
21 void f () noexcept (false)
27 void f(T) noexcept (noexcept (T())) // { dg-warning "false" }
33 void f2(T a) noexcept (noexcept (f (a)))
38 struct A { A() { } }; // { dg-warning "does not throw" }
42 // noexcept(false) allows throw.
43 try { f(); } catch (int) { }
44 // noexcept(noexcept(A())) == noexcept(false).
45 try { f(A()); } catch (int) { }
46 try { f2(A()); } catch (int) { }
48 std::set_terminate (my_terminate);
49 // noexcept(noexcept(int())) == noexcept(true).
50 try { f2(1); } catch (...) { }