fix: unused-template warnings (#6156)

* fix: remove `static` from `type_id`

* Add -Wunused-template for Clang 18

* fix: remove `static` from `type_has_shared_from_this`

* Remove unreachable overload.

---------

Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index eb2fcf2..d6f215a 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -279,7 +279,7 @@
             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 5d7c31c..b71981e 100644
--- a/include/pybind11/detail/struct_smart_holder.h
+++ b/include/pybind11/detail/struct_smart_holder.h
@@ -68,17 +68,11 @@
 // This overload uses SFINAE to skip enable_shared_from_this checks when the
 // base is inaccessible (e.g. private inheritance).
 template <typename T>
-static auto type_has_shared_from_this(const T *ptr)
+auto type_has_shared_from_this(const T *ptr)
     -> decltype(static_cast<const std::enable_shared_from_this<T> *>(ptr), true) {
     return true;
 }
 
-// Inaccessible base → substitution failure → fallback overload selected
-template <typename T>
-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<void> 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 fa5bfe1..4068dd2 100644
--- a/include/pybind11/detail/typeid.h
+++ b/include/pybind11/detail/typeid.h
@@ -68,7 +68,7 @@
 
 /// Return a string representation of a C++ type
 template <typename T>
-static std::string type_id() {
+std::string type_id() {
     return detail::clean_type_id(typeid(T).name());
 }