diff options
author | Abseil Team <absl-team@google.com> | 2023-04-20 20:36:17 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-04-20 20:37:16 -0700 |
commit | 70af93e91542b236dd3acf680cf43334e617dadc (patch) | |
tree | 84e2df7026d3d4f6cbd5e3a2a438072aa50fe41e | |
parent | f8bf909108b3604a00590a074f2986c0895514d2 (diff) |
`AbslHashValue()` applied to a C-style array simply decays the array to a pointer and hashes that, which is very unlikely to be what the author intended.
PiperOrigin-RevId: 525923741
Change-Id: I876dbde341f0b0642fa3d10e3f67b0b31d0311bf
-rw-r--r-- | absl/hash/internal/hash.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/absl/hash/internal/hash.h b/absl/hash/internal/hash.h index 7e534d85..e2397968 100644 --- a/absl/hash/internal/hash.h +++ b/absl/hash/internal/hash.h @@ -411,7 +411,7 @@ AbslHashValue(H hash_state, LongDouble value) { // AbslHashValue() for hashing pointers template <typename H, typename T> -H AbslHashValue(H hash_state, T* ptr) { + H AbslHashValue(H hash_state, T* ptr) { auto v = reinterpret_cast<uintptr_t>(ptr); // Due to alignment, pointers tend to have low bits as zero, and the next few // bits follow a pattern since they are also multiples of some base value. |