Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/test_buffers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ TEST_SUBMODULE(buffers, m) {
+ std::to_string(cols) + "(*" + std::to_string(col_factor)
+ ") matrix");
}

DiscontiguousMatrix(const DiscontiguousMatrix &) = delete;
~DiscontiguousMatrix() {
print_destroyed(this,
std::to_string(rows() / m_row_factor) + "(*"
Expand Down
1 change: 1 addition & 0 deletions tests/test_class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ TEST_SUBMODULE(class_, m) {
// test_exception_rvalue_abort
struct PyPrintDestructor {
PyPrintDestructor() = default;
PyPrintDestructor(const PyPrintDestructor &) = default;
~PyPrintDestructor() { py::print("Print from destructor"); }
void throw_something() { throw std::runtime_error("error"); }
};
Expand Down
1 change: 1 addition & 0 deletions tests/test_class_release_gil_before_calling_cpp_dtor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ struct ProbeType {

public:
explicit ProbeType(const std::string &unique_key) : unique_key{unique_key} {}
ProbeType(const ProbeType &) = default;

~ProbeType() {
RegistryType &reg = PyGILState_Check_Results();
Expand Down
2 changes: 2 additions & 0 deletions tests/test_class_sh_property_non_owning.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ struct DataFieldsHolder {
}
}

DataFieldsHolder(DataFieldsHolder &&) noexcept = default;

DataField *vec_at(std::size_t index) {
if (index >= vec.size()) {
return nullptr;
Expand Down
1 change: 1 addition & 0 deletions tests/test_cross_module_rtti/lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ __pragma(warning(disable : 4251))
class TEST_CROSS_MODULE_RTTI_LIB_EXPORT Base : public std::enable_shared_from_this<Base> {
public:
Base(int a, int b);
Base(const Base &) = default;
virtual ~Base() = default;

virtual int get() const;
Expand Down
1 change: 1 addition & 0 deletions tests/test_eigen_matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ TEST_SUBMODULE(eigen_matrix, m) {

public:
ReturnTester() { print_created(this); }
ReturnTester(const ReturnTester &) = default;
~ReturnTester() { print_destroyed(this); }
static Eigen::MatrixXd create() { return Eigen::MatrixXd::Ones(10, 10); }
// NOLINTNEXTLINE(readability-const-return-type)
Expand Down
1 change: 1 addition & 0 deletions tests/test_numpy_array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ TEST_SUBMODULE(numpy_array, sm) {
struct ArrayClass {
int data[2] = {1, 2};
ArrayClass() { py::print("ArrayClass()"); }
ArrayClass(const ArrayClass &) = default;
~ArrayClass() { py::print("~ArrayClass()"); }
};
py::class_<ArrayClass>(sm, "ArrayClass")
Expand Down
2 changes: 2 additions & 0 deletions tests/test_potentially_slicing_weak_ptr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ namespace potentially_slicing_weak_ptr {

template <int> // Using int as a trick to easily generate multiple types.
struct VirtBase {
VirtBase() = default;
virtual ~VirtBase() = default;
VirtBase(const VirtBase &) = delete;
virtual int get_code() { return 100; }
};

Expand Down
6 changes: 6 additions & 0 deletions tests/test_smart_ptr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ class MyObject4a {
print_created(this);
pointer_set<MyObject4a>().insert(this);
};
MyObject4a(const MyObject4a &) = delete;

int value;

static void cleanupAllInstances() {
Expand All @@ -182,13 +184,15 @@ class MyObject4a {
class MyObject4b : public MyObject4a {
public:
explicit MyObject4b(int i) : MyObject4a(i) { print_created(this); }
MyObject4b(const MyObject4b &) = delete;
~MyObject4b() override { print_destroyed(this); }
};

// test_large_holder
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;
};
Expand Down Expand Up @@ -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); }
};

Expand All @@ -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) + "]";
Expand Down
1 change: 1 addition & 0 deletions tests/test_stl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class OptionalProperties {
using OptionalEnumValue = OptionalImpl<EnumType>;

OptionalProperties() : value(EnumType::kSet) {}
OptionalProperties(const OptionalProperties &) = default;
~OptionalProperties() {
// Reset value to detect use-after-destruction.
// This is set to a specific value rather than nullopt to ensure that
Expand Down
2 changes: 2 additions & 0 deletions tests/test_tagbased_polymorphic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ struct Animal {
// (https://github.com/pybind/pybind11/pull/2016/).
virtual ~Animal() = default;

Animal(const Animal &) = delete;

// Enum for tag-based polymorphism.
enum class Kind {
Unknown = 0,
Expand Down
Loading