Landing: 54f01c74b1b4

Project / Subsystem

gcc / libstdc++

Date

2026-09-02

Author

Nathan Myers

Commit

54f01c74b1b43836d72c3ba8244fd1e679f3b3b3

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
libstdc++
patch_id
—
commit_hash
54f01c74b1b43836d72c3ba8244fd1e679f3b3b3
source_type
github
headline
libstdc++: Fix unordered_map heterogeneous insertion copying [PR126800].
tldr
Corrected `unordered_map` heterogeneous insertion to avoid unnecessary key copying when no insertion occurs.
author
Nathan Myers
outcome
committed
performance_win
false
breaking_change
false
series_id
—
series_parts
[]
tags
  • • libstdc++
  • • bugfix
  • • unordered_map
discussion_id_link
—
bugzilla_pr
—
date
2026-09-02T00:00:00.000Z

A bug in libstdc++‘s unordered_map heterogeneous insertion has been fixed, preventing unnecessary copying of the key when an insertion does not actually happen. The issue involved try_emplace calling an incorrect helper function for new usage cases, which went undetected by tests. This patch corrects try_emplace and other heterogeneous insertion methods (at, insert_or_replace) to call the right helpers and ensures tests verify that keys are not copied when elements are not inserted.