diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2019-04-17 20:27:19 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2019-04-17 20:27:19 +0100 |
commit | 9d3e662d294a2861a1c8fb9825edd11013d621c1 (patch) | |
tree | acc7b47fe11a6e27934c8299fc53839156946ff1 /libstdc++-v3/testsuite/20_util/variant/compile.cc | |
parent | 747742f6f3c80d04109b55ad1e90a77eac3ffd88 (diff) | |
download | gcc-9d3e662d294a2861a1c8fb9825edd11013d621c1.tar.gz |
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
Diffstat (limited to 'libstdc++-v3/testsuite/20_util/variant/compile.cc')
-rw-r--r-- | libstdc++-v3/testsuite/20_util/variant/compile.cc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/libstdc++-v3/testsuite/20_util/variant/compile.cc b/libstdc++-v3/testsuite/20_util/variant/compile.cc index 04fef0be13f..5a2d91709a0 100644 --- a/libstdc++-v3/testsuite/20_util/variant/compile.cc +++ b/libstdc++-v3/testsuite/20_util/variant/compile.cc @@ -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>>, ""); } |