1 // Test for noexcept-specification
2 // { dg-options "-std=c++0x" }
4 #define SA(X) static_assert(X, #X)
7 void f() noexcept(false);
8 void f() noexcept(1 == 0);
13 void g() throw (int); // { dg-error "previous declaration" }
14 void g() noexcept(false); // { dg-error "different exception" }
23 void g (T) noexcept(noexcept(T())); // { dg-error "previous declaration" }
25 void g (T) noexcept(noexcept(T(0))); // { dg-error "different exception" }
28 void f (T) noexcept(noexcept(T()) && noexcept(T()));
30 void f (T) noexcept(noexcept(T()) && noexcept(T()));
32 void f2(T a) noexcept (noexcept (f (a)));
36 SA(!noexcept(f(A())));
38 SA(!noexcept(f2(A())));
40 template <class... Ts>
41 void f3(Ts... ts) noexcept (noexcept (f(ts...)));
44 SA(!noexcept(f3(A())));
46 template <class T1, class T2>
47 void f (T1, T2) noexcept(noexcept(T1(), T2()));
51 SA(noexcept(f3(1,B())));
52 SA(!noexcept(f3(1,A())));
53 SA(!noexcept(f3(A(),1)));
54 SA(!noexcept(f3(A(),A())));