Skip to content

Commit

Permalink
Fix use after move in HashMap::insert
Browse files Browse the repository at this point in the history
Apparently GCC builds worked fine but Clang builds started failing the
"(hash == hash_value(item_key(item)))" assertion.
  • Loading branch information
krobelus committed Nov 18, 2023
1 parent 296ab1a commit 4499b26
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/hash_map.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 4499b26

Please sign in to comment.