From 4499b26ca4541b7c404db2de672506e89a0f9ce1 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sat, 18 Nov 2023 19:07:23 +0100 Subject: [PATCH] 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. --- src/hash_map.hh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hash_map.hh b/src/hash_map.hh index 2f2f6042f6..19406bd1a8 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 requires IsHashCompatible