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' || '' }}" diff --git a/include/pybind11/detail/struct_smart_holder.h b/include/pybind11/detail/struct_smart_holder.h index 5d7c31cdaf..b71981edad 100644 --- a/include/pybind11/detail/struct_smart_holder.h +++ b/include/pybind11/detail/struct_smart_holder.h @@ -68,17 +68,11 @@ 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 *) { - 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. 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()); }