diff options
author | François Dumont <frs.dumont@gmail.com> | 2025-02-16 19:27:49 +0100 |
---|---|---|
committer | François Dumont <fdumont@gcc.gnu.org> | 2025-02-25 22:27:14 +0100 |
commit | bcc8dea6a45b46febfa76df6f5e3e5b13f3b4a58 (patch) | |
tree | 1ea3f5e277df37ea96a375cbfa71d908d07478e6 /gcc | |
parent | dc9db8007519a3240ebf66262be8baba87a98e20 (diff) | |
download | gcc-bcc8dea6a45b46febfa76df6f5e3e5b13f3b4a58.zip gcc-bcc8dea6a45b46febfa76df6f5e3e5b13f3b4a58.tar.gz gcc-bcc8dea6a45b46febfa76df6f5e3e5b13f3b4a58.tar.bz2 |
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.
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions