From d86625aa3fe8ae5dcdcc14658d41d27241701cab Mon Sep 17 00:00:00 2001 From: Lucas Colley Date: Fri, 28 Aug 2026 00:54:09 +0100 Subject: [PATCH 1/4] fix: remove `static` from `type_id` --- include/pybind11/detail/typeid.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/pybind11/detail/typeid.h b/include/pybind11/detail/typeid.h index fa5bfe1645..4068dd29e4 100644 --- a/include/pybind11/detail/typeid.h +++ b/include/pybind11/detail/typeid.h @@ -68,7 +68,7 @@ PYBIND11_NAMESPACE_END(detail) /// Return a string representation of a C++ type template -static std::string type_id() { +std::string type_id() { return detail::clean_type_id(typeid(T).name()); } From c531b933d52a47b2974c33607c50130d0558f715 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Fri, 28 Aug 2026 09:46:14 -0700 Subject: [PATCH 2/4] Add -Wunused-template for Clang 18 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb2fcf2b67..d6f215aa63 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -279,7 +279,7 @@ jobs: container_suffix: "-bullseye" - clang: 18 std: 20 - cxx_flags: "-Werror -Wall -Wextra -Wwrite-strings -Wunreachable-code -Wpointer-arith -Wredundant-decls" + cxx_flags: "-Werror -Wall -Wextra -Wwrite-strings -Wunreachable-code -Wpointer-arith -Wredundant-decls -Wunused-template" container_suffix: "-bookworm" name: "🐍 3 • Clang ${{ matrix.clang }} • C++${{ matrix.std }} • x64${{ matrix.cxx_flags && ' • cxx_flags' || '' }}" From 090b5bd842f3ec3b97b4cbdc602ee4df231239ea Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Fri, 28 Aug 2026 11:33:16 -0700 Subject: [PATCH 3/4] fix: remove `static` from `type_has_shared_from_this` --- include/pybind11/detail/struct_smart_holder.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/pybind11/detail/struct_smart_holder.h b/include/pybind11/detail/struct_smart_holder.h index 5d7c31cdaf..2b48fa56fb 100644 --- a/include/pybind11/detail/struct_smart_holder.h +++ b/include/pybind11/detail/struct_smart_holder.h @@ -68,7 +68,7 @@ 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; } From 5dde98eb47ad004650584d52b4af6870291aec6d Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Fri, 28 Aug 2026 13:07:14 -0700 Subject: [PATCH 4/4] Remove unreachable overload. --- include/pybind11/detail/struct_smart_holder.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/include/pybind11/detail/struct_smart_holder.h b/include/pybind11/detail/struct_smart_holder.h index 2b48fa56fb..b71981edad 100644 --- a/include/pybind11/detail/struct_smart_holder.h +++ b/include/pybind11/detail/struct_smart_holder.h @@ -73,12 +73,6 @@ auto type_has_shared_from_this(const T *ptr) return true; } -// Inaccessible base → substitution failure → fallback overload selected -template -static constexpr bool type_has_shared_from_this(const void *) { - return false; -} - struct guarded_delete { // NOTE: PYBIND11_INTERNALS_VERSION needs to be bumped if changes are made to this struct. std::weak_ptr released_ptr; // Trick to keep the smart_holder memory footprint small.