diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index d79b36b02e..7c26f1d985 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -2204,6 +2204,8 @@ class class_ : public detail::generic_type { init_holder(inst, v_h, (const holder_type *) holder_ptr, v_h.value_ptr()); } +#ifdef PYBIND11_HAVE_INTERNALS_WITH_SMART_HOLDER_SUPPORT + template static bool try_initialization_using_shared_from_this(holder_type *, WrappedType *, ...) { return false; @@ -2229,7 +2231,6 @@ class class_ : public detail::generic_type { return true; } -#ifdef PYBIND11_HAVE_INTERNALS_WITH_SMART_HOLDER_SUPPORT template ::value, int> = 0> static void init_instance(detail::instance *inst, const void *holder_const_void_ptr) { @@ -2264,6 +2265,7 @@ class class_ : public detail::generic_type { = pointee_depends_on_holder_owner; v_h.set_holder_constructed(); } + #endif // PYBIND11_HAVE_INTERNALS_WITH_SMART_HOLDER_SUPPORT /// Deallocates an instance; via holder, if constructed; otherwise via operator delete.