ci: fix clang warnings
diff --git a/tests/test_call_policies.cpp b/tests/test_call_policies.cpp
index fd24557..26c83f8 100644
--- a/tests/test_call_policies.cpp
+++ b/tests/test_call_policies.cpp
@@ -46,6 +46,7 @@
class Parent {
public:
Parent() { py::print("Allocating parent."); }
+ Parent(const Parent& parent) = default;
~Parent() { py::print("Releasing parent."); }
void addChild(Child *) { }
Child *returnChild() { return new Child(); }
diff --git a/tests/test_class.cpp b/tests/test_class.cpp
index 128bc39..7edcdce 100644
--- a/tests/test_class.cpp
+++ b/tests/test_class.cpp
@@ -227,6 +227,8 @@
static void *operator new(size_t s, void *ptr) { py::print("C placement-new", s); return ptr; }
static void operator delete(void *p, size_t s) { py::print("C delete", s); return ::operator delete(p); }
virtual ~AliasedHasOpNewDelSize() = default;
+ AliasedHasOpNewDelSize() = default;
+ AliasedHasOpNewDelSize(const AliasedHasOpNewDelSize&) = delete;
};
struct PyAliasedHasOpNewDelSize : AliasedHasOpNewDelSize {
PyAliasedHasOpNewDelSize() = default;
@@ -277,6 +279,8 @@
class ProtectedB {
public:
virtual ~ProtectedB() = default;
+ ProtectedB() = default;
+ ProtectedB(const ProtectedB &) = delete;
protected:
virtual int foo() const { return value; }
@@ -377,7 +381,11 @@
py::class_<IsNonFinalFinal>(m, "IsNonFinalFinal", py::is_final());
}
-template <int N> class BreaksBase { public: virtual ~BreaksBase() = default; };
+template <int N> class BreaksBase { public:
+ virtual ~BreaksBase() = default;
+ BreaksBase() = default;
+ BreaksBase(const BreaksBase&) = delete;
+};
template <int N> class BreaksTramp : public BreaksBase<N> {};
// These should all compile just fine:
typedef py::class_<BreaksBase<1>, std::unique_ptr<BreaksBase<1>>, BreaksTramp<1>> DoesntBreak1;
diff --git a/tests/test_gil_scoped.cpp b/tests/test_gil_scoped.cpp
index 76c17fd..dc9b7ed 100644
--- a/tests/test_gil_scoped.cpp
+++ b/tests/test_gil_scoped.cpp
@@ -13,7 +13,9 @@
class VirtClass {
public:
- virtual ~VirtClass() {}
+ virtual ~VirtClass() = default;
+ VirtClass() = default;
+ VirtClass(const VirtClass&) = delete;
virtual void virtual_func() {}
virtual void pure_virtual_func() = 0;
};
diff --git a/tests/test_methods_and_attributes.cpp b/tests/test_methods_and_attributes.cpp
index 901f204..11d4e7b 100644
--- a/tests/test_methods_and_attributes.cpp
+++ b/tests/test_methods_and_attributes.cpp
@@ -289,6 +289,7 @@
class DynamicClass {
public:
DynamicClass() { print_default_created(this); }
+ DynamicClass(const DynamicClass&) = delete;
~DynamicClass() { print_destroyed(this); }
};
py::class_<DynamicClass>(m, "DynamicClass", py::dynamic_attr())
diff --git a/tests/test_smart_ptr.cpp b/tests/test_smart_ptr.cpp
index 6f8f382..bea9069 100644
--- a/tests/test_smart_ptr.cpp
+++ b/tests/test_smart_ptr.cpp
@@ -339,6 +339,8 @@
// #187: issue involving std::shared_ptr<> return value policy & garbage collection
struct ElementBase {
virtual ~ElementBase() { } /* Force creation of virtual table */
+ ElementBase() = default;
+ ElementBase(const ElementBase&) = delete;
};
py::class_<ElementBase, std::shared_ptr<ElementBase>>(m, "ElementBase");
diff --git a/tests/test_virtual_functions.cpp b/tests/test_virtual_functions.cpp
index ccf018d..583c1e6 100644
--- a/tests/test_virtual_functions.cpp
+++ b/tests/test_virtual_functions.cpp
@@ -130,6 +130,8 @@
class NCVirt {
public:
virtual ~NCVirt() { }
+ NCVirt() = default;
+ NCVirt(const NCVirt&) = delete;
virtual NonCopyable get_noncopyable(int a, int b) { return NonCopyable(a, b); }
virtual Movable get_movable(int a, int b) = 0;
@@ -151,6 +153,8 @@
/* for some reason MSVC2015 can't compile this if the function is pure virtual */
virtual std::string dispatch() const { return {}; };
virtual ~Base() = default;
+ Base() = default;
+ Base(const Base&) = delete;
};
struct DispatchIssue : Base {
@@ -221,12 +225,15 @@
// don't invoke Python dispatch classes by default when instantiating C++ classes
// that were not extended on the Python side
struct A {
+ A() = default;
+ A(const A&) = delete;
virtual ~A() {}
virtual void f() { py::print("A.f()"); }
};
struct PyA : A {
PyA() { py::print("PyA.PyA()"); }
+ PyA(const PyA&) = delete;
~PyA() { py::print("PyA.~PyA()"); }
void f() override {
@@ -246,12 +253,15 @@
// test_alias_delay_initialization2
// ... unless we explicitly request it, as in this example:
struct A2 {
+ A2() = default;
+ A2(const A2&) = delete;
virtual ~A2() {}
virtual void f() { py::print("A2.f()"); }
};
struct PyA2 : A2 {
PyA2() { py::print("PyA2.PyA2()"); }
+ PyA2(const PyA2&) = delete;
~PyA2() { py::print("PyA2.~PyA2()"); }
void f() override {
py::print("PyA2.f()");
@@ -282,6 +292,8 @@
std::string v;
A a;
explicit OverrideTest(const std::string &v) : v{v} {}
+ OverrideTest() = default;
+ OverrideTest(const OverrideTest&) = delete;
virtual std::string str_value() { return v; }
virtual std::string &str_ref() { return v; }
virtual A A_value() { return a; }
@@ -339,6 +351,8 @@
return say_something(1) + " " + std::to_string(unlucky_number()); \
}
A_METHODS
+ A_Repeat() = default;
+ A_Repeat(const A_Repeat&) = delete;
virtual ~A_Repeat() = default;
};
class B_Repeat : public A_Repeat {
@@ -364,7 +378,12 @@
};
// Base classes for templated inheritance trampolines. Identical to the repeat-everything version:
-class A_Tpl { A_METHODS; virtual ~A_Tpl() = default; };
+class A_Tpl {
+ A_METHODS;
+ A_Tpl() = default;
+ A_Tpl(const A_Tpl&) = delete;
+ virtual ~A_Tpl() = default;
+};
class B_Tpl : public A_Tpl { B_METHODS };
class C_Tpl : public B_Tpl { C_METHODS };
class D_Tpl : public C_Tpl { D_METHODS };