From 4a50fa5cd48f55bb7be108c690caf41dea466442 Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Tue, 23 Feb 2016 23:50:21 +0100 Subject: [PATCH] Address issue with handle::cast(), quench warning in example 12 (fixes #110) --- example/example12.cpp | 1 + include/pybind11/cast.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/example/example12.cpp b/example/example12.cpp index 7bba2c8f9..ab1b48294 100644 --- a/example/example12.cpp +++ b/example/example12.cpp @@ -54,6 +54,7 @@ public: Example12, run_bool ); + throw std::runtime_error("this will never be reached"); } virtual void pure_virtual() { diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index bd504bf86..a9202f6b7 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -574,7 +574,7 @@ template inline object cast(const T &value, return_value_policy pol return object(detail::type_caster::type>::cast(value, policy, parent), false); } -template inline T handle::cast() const { return pybind11::cast(m_ptr); } +template inline T handle::cast() const { return pybind11::cast(*this); } template <> inline void handle::cast() const { return; } template inline object handle::call(Args&&... args_) const {