]>
git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: [_Hashtable] Fix hash code cache usage when stateful hash functor
It is wrong to reuse a cached hash code from another container when this code depends
on the state of the container's Hash functor.
Add checks that Hash functor is stateless before reusing the cached hash code.
libstdc++-v3/ChangeLog:
* include/bits/hashtable_policy.h
(_Hash_code_base::_M_copy_code, _Hash_code_base::_M_store_code): Remove.
* include/bits/hashtable.h (_M_hash_code_ext): New.
(_M_merge_multi(_Hashtable&)): Use latter.
(_M_copy_code): New.
(_M_assign): Use latter.
(_M_bucket_index_ex): New.
(_M_equals): Use latter.
(_M_store_code): New.
(_M_src_hash_code): Remove key_type parameter.
* testsuite/23_containers/unordered_map/modifiers/merge.cc (test10): New
test case.