[Bug libstdc++/126800] Heterogeneous insertion into unordered_map doesn't work.
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Sep 3 18:05:09 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126800
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Nathan Myers <ncm@gcc.gnu.org>:
https://gcc.gnu.org/g:54f01c74b1b43836d72c3ba8244fd1e679f3b3b3
commit r17-3903-g54f01c74b1b43836d72c3ba8244fd1e679f3b3b3
Author: Nathan Myers <ncm@cantrip.org>
Date: Wed Sep 2 09:43:15 2026 -0400
libstdc++: fix unordered_map heterogeneous insertion copying [PR126800]
PR126800 reports that heterogeneous insertions fail to avoid
copying the key when no insertion occurs. They call an existing
member try_emplace that had invoked the wrong helper for their
new usage case, and tests failed to detect the error. This patch
calls the correct helper, and amends tests for heterogeneous
insert operations op[], at(), try_emplace(), and
insert_or_replace().
libstdc++-v3/Changelog:
PR libstdc++/126800
* include/bits/hashtable.h: (try_emplace): Call correct helper.
* testsuite/23_containers/unordered_map/modifiers/hetero/insert.cc:
Check whether key arguments have been copied.
More information about the Gcc-bugs
mailing list