From 7d5275e0c0e4234ce1a75fd7a6dfae82ad8eb1c9 Mon Sep 17 00:00:00 2001 From: Casey Carter Date: Thu, 23 Feb 2023 18:50:13 -0800 Subject: [PATCH] [libc++][test] Silence MSVC deprecation warnings ... for implicitly-generated copy constructors and copy assignment operators. Differential Revision: https://reviews.llvm.org/D144694 --- .../std/utilities/any/any.class/any.modifiers/emplace.pass.cpp | 8 +++++--- .../optional.object/optional.object.assign/emplace.pass.cpp | 2 ++ .../optional.object.assign/emplace_initializer_list.pass.cpp | 4 ++++ .../optional/optional.object/optional.object.dtor/dtor.pass.cpp | 2 ++ .../optional/optional.object/optional.object.mod/reset.pass.cpp | 3 +++ 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/libcxx/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp b/libcxx/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp index 7c5fbfe..bd0d28b 100644 --- a/libcxx/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp +++ b/libcxx/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp @@ -25,9 +25,11 @@ #include "test_macros.h" struct Tracked { - static int count; - Tracked() {++count;} - ~Tracked() { --count; } + static int count; + Tracked() { ++count; } + Tracked(Tracked const&) noexcept { ++count; } + Tracked& operator=(Tracked const&) = default; + ~Tracked() { --count; } }; int Tracked::count = 0; diff --git a/libcxx/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp b/libcxx/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp index 3a627a2..17a1e94 100644 --- a/libcxx/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp +++ b/libcxx/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp @@ -40,6 +40,8 @@ public: static bool dtor_called; Y() = default; Y(int) { TEST_THROW(6);} + Y(const Y&) = default; + Y& operator=(const Y&) = default; ~Y() {dtor_called = true;} }; diff --git a/libcxx/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp b/libcxx/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp index 2323acf..0581fa3 100644 --- a/libcxx/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp +++ b/libcxx/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp @@ -31,6 +31,8 @@ public: constexpr X(int i, bool& dtor_called) : i_(i), dtor_called_(&dtor_called) {} constexpr X(std::initializer_list il, bool& dtor_called) : i_(il.begin()[0]), j_(il.begin()[1]), dtor_called_(&dtor_called) {} + X(const X&) = default; + X& operator=(const X&) = default; TEST_CONSTEXPR_CXX20 ~X() {*dtor_called_ = true;} friend constexpr bool operator==(const X& x, const X& y) @@ -60,6 +62,8 @@ public: Z(int i) : i_(i) {} Z(std::initializer_list il) : i_(il.begin()[0]), j_(il.begin()[1]) { TEST_THROW(6);} + Z(const Z&) = default; + Z& operator=(const Z&) = default; ~Z() {dtor_called = true;} friend bool operator==(const Z& x, const Z& y) diff --git a/libcxx/test/std/utilities/optional/optional.object/optional.object.dtor/dtor.pass.cpp b/libcxx/test/std/utilities/optional/optional.object/optional.object.dtor/dtor.pass.cpp index be127a6..c004427 100644 --- a/libcxx/test/std/utilities/optional/optional.object/optional.object.dtor/dtor.pass.cpp +++ b/libcxx/test/std/utilities/optional/optional.object/optional.object.dtor/dtor.pass.cpp @@ -29,6 +29,8 @@ class X public: static bool dtor_called; X() = default; + X(const X&) = default; + X& operator=(const X&) = default; ~X() {dtor_called = true;} }; diff --git a/libcxx/test/std/utilities/optional/optional.object/optional.object.mod/reset.pass.cpp b/libcxx/test/std/utilities/optional/optional.object/optional.object.mod/reset.pass.cpp index 22544c9..112ee21 100644 --- a/libcxx/test/std/utilities/optional/optional.object/optional.object.mod/reset.pass.cpp +++ b/libcxx/test/std/utilities/optional/optional.object/optional.object.mod/reset.pass.cpp @@ -23,6 +23,9 @@ using std::optional; struct X { static bool dtor_called; + X() = default; + X(const X&) = default; + X& operator=(const X&) = default; ~X() {dtor_called = true;} }; -- 2.7.4