From 6b6e638c96cb03f387ecb469c8551a3b0b8a805e Mon Sep 17 00:00:00 2001 From: Lucas Colley Date: Fri, 28 Aug 2026 00:44:16 +0100 Subject: [PATCH] fix: remove `static` from `type_has_shared_from_this` --- include/pybind11/detail/struct_smart_holder.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/pybind11/detail/struct_smart_holder.h b/include/pybind11/detail/struct_smart_holder.h index 5d7c31cdaf..cd61065adb 100644 --- a/include/pybind11/detail/struct_smart_holder.h +++ b/include/pybind11/detail/struct_smart_holder.h @@ -68,14 +68,14 @@ static constexpr bool type_has_shared_from_this(...) { return false; } // This overload uses SFINAE to skip enable_shared_from_this checks when the // base is inaccessible (e.g. private inheritance). template -static auto type_has_shared_from_this(const T *ptr) +auto type_has_shared_from_this(const T *ptr) -> decltype(static_cast *>(ptr), true) { return true; } // Inaccessible base → substitution failure → fallback overload selected template -static constexpr bool type_has_shared_from_this(const void *) { +constexpr bool type_has_shared_from_this(const void *) { return false; }