From f819fafa12c78b95f80e3c6b3380bbc103ac7818 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Thu, 10 Sep 2026 23:54:11 +0000 Subject: [PATCH] NOLINT the use of sizeof() on a pointer if a pointer is hashed (#7765) The hashing code is generic over the type of the value being given to sizeof() so ideally this warning would not happen at all, but it does. Possibly because the value is the return of an overload set, so it's not obvious that it's the templated type. One of those overloads returns `const void*` but change that to an integer does not remove the warning still. --- common/hashing.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/hashing.h b/common/hashing.h index 8d4127a8224c..3f31d85f2e2b 100644 --- a/common/hashing.h +++ b/common/hashing.h @@ -822,6 +822,9 @@ inline auto Hasher::Hash(const Ts&... values) -> void { return static_cast(HashValue(value)); } else if constexpr (CanHashAsRawDataType) { auto raw_value = MapToRawDataType(value); + // If we are hashing a pointer, then `raw_value` is a pointer, but that + // is what we want the size of. + // NOLINTNEXTLINE(bugprone-sizeof-expression) if constexpr (sizeof(raw_value) <= 8) { return ReadSmall(raw_value); } else {