//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 // // flat_set& operator=(flat_set&&); #include #include #include #include #include #include #include #include "test_macros.h" #include "MoveOnly.h" #include "../helpers.h" #include "../../../test_compare.h" #include "test_allocator.h" #include "min_allocator.h" struct MoveNegates { int value_ = 0; MoveNegates() = default; constexpr MoveNegates(int v) : value_(v) {} constexpr MoveNegates(MoveNegates&& rhs) : value_(rhs.value_) { rhs.value_ = -rhs.value_; } constexpr MoveNegates& operator=(MoveNegates&& rhs) { value_ = rhs.value_; rhs.value_ = -rhs.value_; return *this; } ~MoveNegates() = default; auto operator<=>(const MoveNegates&) const = default; }; struct MoveClears { int value_ = 0; MoveClears() = default; constexpr MoveClears(int v) : value_(v) {} constexpr MoveClears(MoveClears&& rhs) : value_(rhs.value_) { rhs.value_ = 0; } constexpr MoveClears& operator=(MoveClears&& rhs) { value_ = rhs.value_; rhs.value_ = 0; return *this; } ~MoveClears() = default; auto operator<=>(const MoveClears&) const = default; }; #if !defined(TEST_HAS_NO_EXCEPTIONS) struct MoveAssignThrows : std::vector { using std::vector::vector; MoveAssignThrows& operator=(MoveAssignThrows&& other) { push_back(0); push_back(0); other.push_back(0); other.push_back(0); throw 42; } }; #endif // TEST_HAS_NO_EXCEPTIONS template