* decl.c (make_typename_type): s/parameters/arguments/.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / noexcept02.C
bloba94fa03ad2b402a865a4a0a5b7b7d60757b92dae
1 // Test for noexcept-specification
2 // { dg-do compile { target c++11 } }
4 #define SA(X) static_assert(X, #X)
6 void f();
7 void f() noexcept(false);
8 void f() noexcept(1 == 0);
9 void f();
11 SA(!noexcept(f()));
13 void g() throw (int);           // { dg-message "previous declaration" "" { target { ! c++17 } } }
14                                 // { dg-error "dynamic exception specification" "" { target c++17 } .-1 }
15                                 // { dg-warning "deprecated" "" { target { ! c++17 } } .-2 }
16 void g() noexcept(false);       // { dg-error "different exception" "" { target { ! c++17 } } }
17 void g();
19 void h() throw();
20 void h() noexcept;
21 void h() throw();
22 void h() noexcept;
24 template <class T>
25 void g (T) noexcept(noexcept(T())); // { dg-message "previous declaration" }
26 template <class T>
27 void g (T) noexcept(noexcept(T(0))); // { dg-error "different exception" }
29 template <class T>
30 void f (T) noexcept(noexcept(T()) && noexcept(T()));
31 template <class T>
32 void f (T) noexcept(noexcept(T()) && noexcept(T()));
33 template <class T>
34 void f2(T a) noexcept (noexcept (f (a)));
36 struct A { A(); };
37 SA(noexcept(f(1)));
38 SA(!noexcept(f(A())));
39 SA(noexcept(f2(1)));
40 SA(!noexcept(f2(A())));
42 template <class... Ts>
43 void f3(Ts... ts) noexcept (noexcept (f(ts...)));
45 SA(noexcept(f3(1)));
46 SA(!noexcept(f3(A())));
48 template <class T1, class T2>
49 void f (T1, T2) noexcept(noexcept(T1(), T2()));
51 struct B { };
53 SA(noexcept(f3(1,B())));
54 SA(!noexcept(f3(1,A())));
55 SA(!noexcept(f3(A(),1)));
56 SA(!noexcept(f3(A(),A())));