tests: add or delete copy/move ctors where needed to make type traits match reality (#5833)

This commit is contained in:
Joshua Oreman
2025-09-08 15:47:24 -07:00
committed by GitHub
parent a6581eee89
commit 68cbae6641
11 changed files with 19 additions and 1 deletions
+6
View File
@@ -161,6 +161,8 @@ public:
print_created(this);
pointer_set<MyObject4a>().insert(this);
};
MyObject4a(const MyObject4a &) = delete;
int value;
static void cleanupAllInstances() {
@@ -182,6 +184,7 @@ protected:
class MyObject4b : public MyObject4a {
public:
explicit MyObject4b(int i) : MyObject4a(i) { print_created(this); }
MyObject4b(const MyObject4b &) = delete;
~MyObject4b() override { print_destroyed(this); }
};
@@ -189,6 +192,7 @@ public:
class MyObject5 { // managed by huge_unique_ptr
public:
explicit MyObject5(int value) : value{value} { print_created(this); }
MyObject5(const MyObject5 &) = delete;
~MyObject5() { print_destroyed(this); }
int value;
};
@@ -245,6 +249,7 @@ struct SharedFromThisVirt : virtual SharedFromThisVBase {};
// test_move_only_holder
struct C {
C() { print_created(this); }
C(const C &) = delete;
~C() { print_destroyed(this); }
};
@@ -265,6 +270,7 @@ struct TypeForHolderWithAddressOf {
// test_move_only_holder_with_addressof_operator
struct TypeForMoveOnlyHolderWithAddressOf {
explicit TypeForMoveOnlyHolderWithAddressOf(int value) : value{value} { print_created(this); }
TypeForMoveOnlyHolderWithAddressOf(const TypeForMoveOnlyHolderWithAddressOf &) = delete;
~TypeForMoveOnlyHolderWithAddressOf() { print_destroyed(this); }
std::string toString() const {
return "MoveOnlyHolderWithAddressOf[" + std::to_string(value) + "]";