From d6f1c50c34292d4db2dfec8ae291aa05415789ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 13 Sep 2019 16:48:54 +0200 Subject: [PATCH] python: I'm happy to see MSVC continuing to be consistenly underdelivering. --- src/Magnum/SceneGraph/Python.h | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/Magnum/SceneGraph/Python.h b/src/Magnum/SceneGraph/Python.h index e5cdcbd..4e2d12b 100644 --- a/src/Magnum/SceneGraph/Python.h +++ b/src/Magnum/SceneGraph/Python.h @@ -62,22 +62,27 @@ template struct PyFeatureHolder: std::unique_ptr { /* Hey this needs docs. */ -template class PyObject: public Object { +/* This template parameter can't be just Object, as that makes MSVC confused + when CRTP'ing something else than a class named Object -- it fails inside + the Object{} call in the constructor, saying `error C2614: + 'Magnum::SceneGraph::PyObject': illegal member initialization: + 'Object' is not a base or member`. */ +template class PyObject: public Object_ { public: - template explicit PyObject(Args&&... args): Object{std::forward(args)...} {} + template explicit PyObject(Args&&... args): Object_{std::forward(args)...} {} - PyObject(const PyObject&) = delete; - PyObject(PyObject&&) = delete; + PyObject(const PyObject&) = delete; + PyObject(PyObject&&) = delete; - PyObject& operator=(const PyObject&) = delete; - PyObject& operator=(PyObject&&) = delete; + PyObject& operator=(const PyObject&) = delete; + PyObject& operator=(PyObject&&) = delete; private: void doErase() override { /* When deleting a parent, disconnect this from the parent instead of deleting it. Deletion is then handled by Python itself. */ - CORRADE_INTERNAL_ASSERT(Object::parent()); - Object::setParent(nullptr); + CORRADE_INTERNAL_ASSERT(Object_::parent()); + Object_::setParent(nullptr); pybind11::cast(this).dec_ref(); } };