2019-04-17 Jonathan Wakely <jwakely@redhat.com>
+ * testsuite/20_util/variant/compile.cc (MoveCtorOnly): Fix type to
+ actually match its name.
+ (MoveCtorAndSwapOnly): Define new type that adds swap to MoveCtorOnly.
+ (test_swap()): Fix result for MoveCtorOnly and check
+ MoveCtorAndSwapOnly.
+
* include/std/optional (optional::value_or(U&&) &&): Add missing
constexpr specifier.
* testsuite/20_util/optional/constexpr/observers/4.cc: Check value_or
struct MoveCtorOnly
{
MoveCtorOnly() noexcept = delete;
- MoveCtorOnly(const DefaultNoexcept&) noexcept = delete;
- MoveCtorOnly(DefaultNoexcept&&) noexcept { }
- MoveCtorOnly& operator=(const DefaultNoexcept&) noexcept = delete;
- MoveCtorOnly& operator=(DefaultNoexcept&&) noexcept = delete;
+ MoveCtorOnly(const MoveCtorOnly&) noexcept = delete;
+ MoveCtorOnly(MoveCtorOnly&&) noexcept { }
+ MoveCtorOnly& operator=(const MoveCtorOnly&) noexcept = delete;
+ MoveCtorOnly& operator=(MoveCtorOnly&&) noexcept = delete;
};
+struct MoveCtorAndSwapOnly : MoveCtorOnly { };
+void swap(MoveCtorAndSwapOnly&, MoveCtorAndSwapOnly&) { }
+
struct nonliteral
{
nonliteral() { }
void test_swap()
{
static_assert(is_swappable_v<variant<int, string>>, "");
- static_assert(is_swappable_v<variant<MoveCtorOnly>>, "");
+ static_assert(!is_swappable_v<variant<MoveCtorOnly>>, "");
+ static_assert(is_swappable_v<variant<MoveCtorAndSwapOnly>>, "");
static_assert(!is_swappable_v<variant<AllDeleted>>, "");
}