PR c++/85765 - SFINAE and non-type default template arg.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / noexcept17.C
blob9ea1623880445ac0bf4ecb8dd70dd2a7c17c2a42
1 // PR c++/50043
2 // { dg-do compile { target c++11 } }
3 // { dg-options "-Wno-terminate" }
5 struct True1 {};
6 struct True2 { ~True2(); };
7 struct True3 { ~True3(){ throw 0; } };
8 struct False { ~False() noexcept(false); };
10 template <typename Base>
11 struct A : Base
15 template <typename Member>
16 struct B
18     Member mem;
21 template <typename Base, typename Member>
22 struct C : Base
24     Member mem;
27 #define SA(X) static_assert(X, #X)
29 SA( noexcept(True1()));
30 SA( noexcept(True2()));
31 SA( noexcept(True3()));
32 SA(!noexcept(False()));
34 SA( noexcept(A<True1>()));
35 SA( noexcept(A<True2>()));
36 SA( noexcept(A<True3>()));
37 SA(!noexcept(A<False>()));
39 SA( noexcept(B<True1>()));
40 SA( noexcept(B<True2>()));
41 SA( noexcept(B<True3>()));
42 SA(!noexcept(B<False>()));
44 SA( noexcept(C<True1, True2>()));
45 SA( noexcept(C<True1, True3>()));
46 SA( noexcept(C<True2, True3>()));
47 SA( noexcept(C<True2, True1>()));
48 SA( noexcept(C<True3, True1>()));
49 SA( noexcept(C<True3, True2>()));
50 SA(!noexcept(C<False, True1>()));
51 SA(!noexcept(C<False, True2>()));
52 SA(!noexcept(C<False, True3>()));
53 SA(!noexcept(C<True1, False>()));
54 SA(!noexcept(C<True2, False>()));
55 SA(!noexcept(C<True3, False>()));