diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index 6c5df2299..dd19a74e6 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -895,7 +895,9 @@ template struct return_value_policy_ov }; template struct return_value_policy_override>::value, void>> { + detail::enable_if_t< + std::is_base_of>::value || + type_uses_smart_holder_type_caster>::value, void>> { static return_value_policy policy(return_value_policy p) { return !std::is_lvalue_reference::value && !std::is_pointer::value