summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohannes Altmanninger <aclopte@gmail.com>2023-11-18 19:07:23 +0100
committerJohannes Altmanninger <aclopte@gmail.com>2023-11-18 19:07:23 +0100
commit4499b26ca4541b7c404db2de672506e89a0f9ce1 (patch)
treeaf15ebd72b8f2ce570988351db0e62fdb5ff373d /src
parent296ab1a1ffb707f4691cdce21172b3b8d0b48eb0 (diff)
Fix use after move in HashMap::insert
Apparently GCC builds worked fine but Clang builds started failing the "(hash == hash_value(item_key(item)))" assertion.
Diffstat (limited to 'src')
-rw-r--r--src/hash_map.hh3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/hash_map.hh b/src/hash_map.hh
index 2f2f6042..19406bd1 100644
--- a/src/hash_map.hh
+++ b/src/hash_map.hh
@@ -214,7 +214,8 @@ struct HashMap
constexpr EffectiveValue& insert(Item item)
{
- return insert(std::move(item), hash_value(item_key(item)));
+ const auto hash = hash_value(item_key(item));
+ return insert(std::move(item), hash);
}
template<typename KeyType> requires IsHashCompatible<Key, KeyType>