[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 19:01:39 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126800
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-16 branch has been updated by Nathan Myers <ncm@gcc.gnu.org>:
https://gcc.gnu.org/g:550de9ba02593e487e9921aea43a70f21fca0544
commit r16-9625-g550de9ba02593e487e9921aea43a70f21fca0544
Author: Nathan Myers <ncm@cantrip.org>
Date: Thu Sep 3 14:14:00 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().
(Copied from trunk r17-3903-g54f01c74)
libstdc++-v3/Changelog:
PR libstdc++/126800
* include/bits/hashtable.h: (try_emplace): Call correct helper.
* testsuite/23_containers/unordered_map/modifiers/hetero/insert.cc:
whether key arguments have been copied.
More information about the Gcc-bugs
mailing list