From 1af3e71c706cbd1a8ee814acbdb2a2c93424f2ed Mon Sep 17 00:00:00 2001 From: Lucas Colley Date: Sat, 17 Oct 2026 22:18:03 +0100 Subject: [PATCH] Remove static from namespace-scope function templates Namespace-scope `static` in a header gives each translation unit its own internal-linkage copy, which triggers clang's -Wunused-template in TUs that don't use them. Function templates don't need `static` to avoid ODR violations. Fixes #98 --- include/tsl/robin_hash.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/tsl/robin_hash.h b/include/tsl/robin_hash.h index 51662be..a5c264c 100644 --- a/include/tsl/robin_hash.h +++ b/include/tsl/robin_hash.h @@ -67,8 +67,7 @@ struct is_power_of_two_policy> : std::true_type {}; template -static T numeric_cast(U value, - const char* error_message = "numeric_cast() failed.") { +T numeric_cast(U value, const char* error_message = "numeric_cast() failed.") { T ret = static_cast(value); if (static_cast(ret) != value) { TSL_RH_THROW_OR_TERMINATE(std::runtime_error, error_message); @@ -87,7 +86,7 @@ static T numeric_cast(U value, } template -static T deserialize_value(Deserializer& deserializer) { +T deserialize_value(Deserializer& deserializer) { // MSVC < 2017 is not conformant, circumvent the problem by removing the // template keyword #if defined(_MSC_VER) && _MSC_VER < 1910