From 5566c63ebf8028d49a761aa18250ddf1f5cf613b Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Fri, 19 Jul 2024 19:42:12 -0700 Subject: [PATCH] Move `try_initialization_using_shared_from_this` into `PYBIND11_HAVE_INTERNALS_WITH_SMART_HOLDER_SUPPORT` block. --- include/pybind11/pybind11.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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.