diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index 8547f283a..12cc5b28e 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -567,7 +567,7 @@ template inline T cast(handle handle) { detail::type_caster::type> conv; if (!conv.load(handle, true)) throw cast_error("Unable to cast Python object to C++ type"); - return conv; + return (T) conv; } template inline object cast(const T &value, return_value_policy policy = return_value_policy::automatic, handle parent = handle()) {