[Bug libstdc++/117921] containers do not use ADL swap for Compare, Pred or Hash types
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Feb 28 15:28:27 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117921
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-14 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:
https://gcc.gnu.org/g:dd8866d79632ddcf4811859e98f5c990627d5727
commit r14-11355-gdd8866d79632ddcf4811859e98f5c990627d5727
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Thu Dec 5 12:46:26 2024 +0000
libstdc++: Use ADL swap for containers' function objects [PR117921]
The standard says that Compare, Pred and Hash objects should be swapped
as described in [swappable.requirements] which means calling swap
unqualified with std::swap visible to name lookup.
libstdc++-v3/ChangeLog:
PR libstdc++/117921
* include/bits/hashtable_policy.h (_Hash_code_base::_M_swap):
Use ADL swap for Hash members.
(_Hashtable_base::_M_swap): Use ADL swap for _Equal members.
* include/bits/stl_tree.h (_Rb_tree::swap): Use ADL swap for
_Compare members.
* testsuite/23_containers/set/modifiers/swap/adl.cc: New test.
* testsuite/23_containers/unordered_set/modifiers/swap-2.cc: New
test.
(cherry picked from commit 0368c42507328774cadbea589509b95aaf3cb826)
More information about the Gcc-bugs
mailing list