gcc/testsuite/g++.dg/ext/is_nothrow_convertible2.C
raw| 1 | // PR c++/106784 |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | |
| 4 | #define SA(X) static_assert((X),#X) |
| 5 | |
| 6 | struct A { }; |
| 7 | struct B { }; |
| 8 | |
| 9 | struct M { |
| 10 | operator A(); |
| 11 | operator B() noexcept; |
| 12 | M(const A&); |
| 13 | M(const B&) noexcept; |
| 14 | }; |
| 15 | |
| 16 | SA(!__is_nothrow_convertible(A, M)); |
| 17 | SA(!__is_nothrow_convertible(M, A)); |
| 18 | SA(__is_nothrow_convertible(B, M)); |
| 19 | SA(__is_nothrow_convertible(M, B)); |