Skip to content

Commit 7d5275e

Browse files
committed
[libc++][test] Silence MSVC deprecation warnings
... for implicitly-generated copy constructors and copy assignment operators. Differential Revision: https://reviews.llvm.org/D144694
1 parent 8709bca commit 7d5275e

File tree

5 files changed

+16
-3
lines changed

5 files changed

+16
-3
lines changed

libcxx/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@
2525
#include "test_macros.h"
2626

2727
struct Tracked {
28-
static int count;
29-
Tracked() {++count;}
30-
~Tracked() { --count; }
28+
static int count;
29+
Tracked() { ++count; }
30+
Tracked(Tracked const&) noexcept { ++count; }
31+
Tracked& operator=(Tracked const&) = default;
32+
~Tracked() { --count; }
3133
};
3234
int Tracked::count = 0;
3335

libcxx/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ class Y
4040
static bool dtor_called;
4141
Y() = default;
4242
Y(int) { TEST_THROW(6);}
43+
Y(const Y&) = default;
44+
Y& operator=(const Y&) = default;
4345
~Y() {dtor_called = true;}
4446
};
4547

libcxx/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ class X
3131
constexpr X(int i, bool& dtor_called) : i_(i), dtor_called_(&dtor_called) {}
3232
constexpr X(std::initializer_list<int> il, bool& dtor_called)
3333
: i_(il.begin()[0]), j_(il.begin()[1]), dtor_called_(&dtor_called) {}
34+
X(const X&) = default;
35+
X& operator=(const X&) = default;
3436
TEST_CONSTEXPR_CXX20 ~X() {*dtor_called_ = true;}
3537

3638
friend constexpr bool operator==(const X& x, const X& y)
@@ -60,6 +62,8 @@ class Z
6062
Z(int i) : i_(i) {}
6163
Z(std::initializer_list<int> il) : i_(il.begin()[0]), j_(il.begin()[1])
6264
{ TEST_THROW(6);}
65+
Z(const Z&) = default;
66+
Z& operator=(const Z&) = default;
6367
~Z() {dtor_called = true;}
6468

6569
friend bool operator==(const Z& x, const Z& y)

libcxx/test/std/utilities/optional/optional.object/optional.object.dtor/dtor.pass.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ class X
2929
public:
3030
static bool dtor_called;
3131
X() = default;
32+
X(const X&) = default;
33+
X& operator=(const X&) = default;
3234
~X() {dtor_called = true;}
3335
};
3436

libcxx/test/std/utilities/optional/optional.object/optional.object.mod/reset.pass.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ using std::optional;
2323
struct X
2424
{
2525
static bool dtor_called;
26+
X() = default;
27+
X(const X&) = default;
28+
X& operator=(const X&) = default;
2629
~X() {dtor_called = true;}
2730
};
2831

0 commit comments

Comments
 (0)