aboutsummaryrefslogtreecommitdiffstats
path: root/3rdparty/pybind11/tests/test_smart_ptr.cpp
diff options
context:
space:
mode:
authorMiodrag Milanovic <mmicko@gmail.com>2021-01-02 10:15:39 +0100
committerMiodrag Milanovic <mmicko@gmail.com>2021-01-02 10:15:39 +0100
commite76cdab6dd77bad411e6ac9372ee527aff89ef17 (patch)
treee9868f05cf455336d75f33b1312d71034f8fb334 /3rdparty/pybind11/tests/test_smart_ptr.cpp
parentc6cdf30501dcb2da01361229dd66a05dad73a132 (diff)
downloadnextpnr-e76cdab6dd77bad411e6ac9372ee527aff89ef17.tar.gz
nextpnr-e76cdab6dd77bad411e6ac9372ee527aff89ef17.tar.bz2
nextpnr-e76cdab6dd77bad411e6ac9372ee527aff89ef17.zip
Update pybind11 to version 2.6.1
Diffstat (limited to '3rdparty/pybind11/tests/test_smart_ptr.cpp')
-rw-r--r--3rdparty/pybind11/tests/test_smart_ptr.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/3rdparty/pybind11/tests/test_smart_ptr.cpp b/3rdparty/pybind11/tests/test_smart_ptr.cpp
index 87c9be8c..60c2e692 100644
--- a/3rdparty/pybind11/tests/test_smart_ptr.cpp
+++ b/3rdparty/pybind11/tests/test_smart_ptr.cpp
@@ -27,7 +27,8 @@ namespace pybind11 { namespace detail {
struct holder_helper<ref<T>> {
static const T *get(const ref<T> &p) { return p.get_ptr(); }
};
-}}
+} // namespace detail
+} // namespace pybind11
// The following is not required anymore for std::shared_ptr, but it should compile without error:
PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr<T>);
@@ -97,9 +98,9 @@ TEST_SUBMODULE(smart_ptr, m) {
class MyObject1 : public Object {
public:
MyObject1(int value) : value(value) { print_created(this, toString()); }
- std::string toString() const { return "MyObject1[" + std::to_string(value) + "]"; }
+ std::string toString() const override { return "MyObject1[" + std::to_string(value) + "]"; }
protected:
- virtual ~MyObject1() { print_destroyed(this); }
+ ~MyObject1() override { print_destroyed(this); }
private:
int value;
};
@@ -207,7 +208,7 @@ TEST_SUBMODULE(smart_ptr, m) {
class MyObject4b : public MyObject4a {
public:
MyObject4b(int i) : MyObject4a(i) { print_created(this); }
- ~MyObject4b() { print_destroyed(this); }
+ ~MyObject4b() override { print_destroyed(this); }
};
py::class_<MyObject4b, MyObject4a>(m, "MyObject4b")
.def(py::init<int>());
@@ -291,7 +292,8 @@ TEST_SUBMODULE(smart_ptr, m) {
~C() { print_destroyed(this); }
};
py::class_<C, custom_unique_ptr<C>>(m, "TypeWithMoveOnlyHolder")
- .def_static("make", []() { return custom_unique_ptr<C>(new C); });
+ .def_static("make", []() { return custom_unique_ptr<C>(new C); })
+ .def_static("make_as_object", []() { return py::cast(custom_unique_ptr<C>(new C)); });
// test_holder_with_addressof_operator
struct TypeForHolderWithAddressOf {
@@ -337,7 +339,9 @@ TEST_SUBMODULE(smart_ptr, m) {
// test_shared_ptr_gc
// #187: issue involving std::shared_ptr<> return value policy & garbage collection
struct ElementBase {
- virtual ~ElementBase() { } /* Force creation of virtual table */
+ virtual ~ElementBase() = default; /* Force creation of virtual table */
+ ElementBase() = default;
+ ElementBase(const ElementBase&) = delete;
};
py::class_<ElementBase, std::shared_ptr<ElementBase>>(m, "ElementBase");