<map>
, <unordered_map>
: Allow MapLike<K, V&>
again
#3660
Merged
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_assert
s, 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.)