| 1 |
// PR c++/98388 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
struct moveonly { |
| 5 |
moveonly() = default; |
| 6 |
moveonly(moveonly&&) = default; |
| 7 |
}; |
| 8 |
|
| 9 |
template<class T> |
| 10 |
constexpr auto is_throwable(T t) -> decltype(throw t, true) { |
| 11 |
return true; |
| 12 |
} |
| 13 |
template<class T> |
| 14 |
constexpr bool is_throwable(...) { return false; } |
| 15 |
|
| 16 |
constexpr bool b = is_throwable<moveonly>(moveonly{}); |
| 17 |
#if __cplusplus >= 202002L |
| 18 |
static_assert (b, "move from the function parameter"); |
| 19 |
#else |
| 20 |
static_assert (!b, "no move from the function parameter"); |
| 21 |
#endif |