Skip to content

Implement LWG-4223 Deduction guides for maps are mishandling tuples and references#6305

Open
frederick-vs-ja wants to merge 2 commits into
microsoft:mainfrom
frederick-vs-ja:lwg-4223
Open

Implement LWG-4223 Deduction guides for maps are mishandling tuples and references#6305
frederick-vs-ja wants to merge 2 commits into
microsoft:mainfrom
frederick-vs-ja:lwg-4223

Conversation

@frederick-vs-ja

Copy link
Copy Markdown
Contributor

Fixes #6207. I believe the remove_cvref_t parts should be applied to C++17 mode.

Copilot AI review requested due to automatic review settings June 9, 2026 01:23
@frederick-vs-ja frederick-vs-ja requested a review from a team as a code owner June 9, 2026 01:23
@github-project-automation github-project-automation Bot moved this to Initial Review in STL Code Reviews Jun 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR implements LWG-4223 fixes for C++ standard library deduction guides, ensuring that associative container deduction guides properly strip cv-qualifiers and references from key and value types.

Changes:

  • Updates _Guide_key_t, _Guide_val_t, _Guide_pair_t, _Range_key_type, _Range_mapped_type, and _Range_to_alloc_type to use remove_cvref_t/_Remove_cvref_t and tuple_element_t instead of direct member access with only remove_const_t.
  • Adds comprehensive tests for map/multimap and unordered_map/unordered_multimap deduction with cv-ref qualified pair/tuple types.
  • Updates flat_map tests to verify LWG-4223 with an almost_pair type that no longer exposes first_type/second_type aliases.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
stl/inc/xutility Updates _Guide_key_t, _Guide_val_t to use remove_cvref_t and simplifies _Guide_pair_t
stl/inc/xmemory Updates _Range_key_type, _Range_mapped_type, _Range_to_alloc_type to use tuple_element_t with remove_cvref_t
tests/std/tests/P0433R2_deduction_guides/test.cpp Adds deduction guide tests for pairs/tuples with cv-ref qualified types
tests/std/tests/P0429R9_flat_map/test.cpp Updates almost_pair and adds flat_map/flat_multimap construction tests for LWG-4223

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/std/tests/P0429R9_flat_map/test.cpp Outdated
Comment thread tests/std/tests/P0429R9_flat_map/test.cpp Outdated
@StephanTLavavej StephanTLavavej added the LWG Library Working Group issue label Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

LWG Library Working Group issue

Projects

Status: Initial Review

Development

Successfully merging this pull request may close these issues.

LWG-4223 Deduction guides for maps are mishandling tuples and references

3 participants