| 1 |
// { dg-do compile { target c++11 } } |
| 2 |
|
| 3 |
struct A { }; |
| 4 |
struct B { B(); operator int(); }; |
| 5 |
struct C { |
| 6 |
C() = default; |
| 7 |
C(const C&); |
| 8 |
C(C&&) = default; |
| 9 |
C& operator=(C&&); |
| 10 |
C& operator= (const C&) = default; |
| 11 |
}; |
| 12 |
struct D { ~D() noexcept(false) {} }; |
| 13 |
|
| 14 |
#define SA(X) static_assert((X),#X) |
| 15 |
|
| 16 |
SA(__is_nothrow_constructible(A)); |
| 17 |
SA(__is_nothrow_constructible(A,A)); |
| 18 |
SA(!__is_nothrow_constructible(B)); |
| 19 |
SA(__is_nothrow_constructible(B,B)); |
| 20 |
|
| 21 |
SA(!__is_nothrow_constructible(A,B)); |
| 22 |
SA(!__is_nothrow_constructible(B,A)); |
| 23 |
|
| 24 |
SA(__is_nothrow_constructible(C)); |
| 25 |
SA(__is_nothrow_constructible(C,C)); |
| 26 |
SA(!__is_nothrow_constructible(C,C&)); |
| 27 |
SA(__is_nothrow_assignable(C,C&)); |
| 28 |
SA(!__is_nothrow_assignable(C,C)); |
| 29 |
SA(!__is_nothrow_assignable(C,C&&)); |
| 30 |
SA(!__is_nothrow_assignable(void,int)); |
| 31 |
SA(!__is_nothrow_assignable(const void,int)); |
| 32 |
SA(!__is_nothrow_assignable(volatile void,int)); |
| 33 |
SA(!__is_nothrow_assignable(const volatile void,int)); |
| 34 |
|
| 35 |
SA(__is_nothrow_constructible(int,int)); |
| 36 |
SA(__is_nothrow_constructible(int,double)); |
| 37 |
SA(!__is_nothrow_constructible(int,B)); |
| 38 |
SA(!__is_nothrow_constructible(void,int)); |
| 39 |
SA(!__is_nothrow_constructible(const void,int)); |
| 40 |
SA(!__is_nothrow_constructible(volatile void,int)); |
| 41 |
SA(!__is_nothrow_constructible(const volatile void,int)); |
| 42 |
SA(!__is_nothrow_constructible(int, void*)); |
| 43 |
SA(!__is_nothrow_constructible(int, int*)); |
| 44 |
SA(!__is_nothrow_constructible(int, const int*)); |
| 45 |
SA(!__is_nothrow_constructible(int*, void*)); |
| 46 |
SA(!__is_nothrow_constructible(int*, const int*)); |
| 47 |
|
| 48 |
SA(!__is_nothrow_constructible(D)); |