<map>, <unordered_map>: Allow MapLike<K, V&> again#3660
Merged
StephanTLavavej merged 1 commit intomicrosoft:mainfrom Apr 20, 2023
Merged
<map>, <unordered_map>: Allow MapLike<K, V&> again#3660StephanTLavavej merged 1 commit intomicrosoft:mainfrom
<map>, <unordered_map>: Allow MapLike<K, V&> again#3660StephanTLavavej merged 1 commit intomicrosoft:mainfrom
Conversation
barcharcraz
approved these changes
Apr 20, 2023
Member
Author
|
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
[associative.reqmts.general]/8 says that the rules applying to |
Contributor
|
I think the cross-references in [associative.reqmts.general] are swapped; it doesn't make sense to apply the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One of the changes that I pushed to #2436 was damaging - while map-like types can't tolerate references as key types, using references as mapped types appears to be permitted (by the Standard, libstdc++, and libc++), and there are 4 projects across vcpkg and Real World Code that are doing this.
Fortunately, we can fix this before changes stop flowing into VS 2022 17.7 Preview 2, so users will never be affected. I'm removing my bad
static_asserts, and adding test coverage to minimally verify that this scenario compiles.(I suppose we could instead assert that the mapped types aren't function types or void types, but I'd rather just drop it entirely. Such usage is extremely unlikely and will still be rejected, just with lengthy diagnostics.)