Fix tests for std::variant to match original intention
* 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. From-SVN: r270423
This commit is contained in:
parent
747742f6f3
commit
9d3e662d29
|
@ -1,5 +1,11 @@
|
|||
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
|
||||
|
|
|
@ -54,12 +54,15 @@ struct DefaultNoexcept
|
|||
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() { }
|
||||
|
@ -259,7 +262,8 @@ static_assert( !std::is_swappable_v<variant<D, int>> );
|
|||
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>>, "");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue