Fortran: Fix PR 47485.
[gcc.git] / gcc / testsuite / g++.dg / cpp0x / sfinae69.C
blob60eba61165dea687eeef42ec67ec3e0897d82324
1 // PR c++/98388
2 // { dg-do compile { target c++11 } }
4 struct moveonly {
5     moveonly() = default;
6     moveonly(moveonly&&) = default;
7 };
9 template<class T>
10 constexpr auto is_throwable(T t) -> decltype(throw t, true) {
11     return true;
13 template<class T>
14 constexpr bool is_throwable(...) { return false; }
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