You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Currently, these internal tagged constructors are implemented in some non-conforming manner such that they can be selected by conforming user codes. They exist for constructing containers with the stored allocators move-constructed, while the corresponding standard constructors copy-construct allocators. This PR removes the these internal tagged constructors and makes allocators copy-constructed.
Although the Standard currently requires that sometimes the allocator is move-constructed ([container.reqmts]), it's highly unusual and perhaps pointless to make move construction of an allocator type not equivalent to copy construction, because LWG-2593 requires that the move construction doesn't change the value of the source allocator. It seems that there can be different side effects can be different, but such difference can't affect further allocations.
In the future, there might be an LWG issue to allow move construction of containers to copy-construct allocators.
Affected tests - skipped during the development, unskipped later due to another approach
I had to push an additional commit due to a /clr:pure bug that rejects the test:
D:\msvc\src\vctools\crt\github\tests\std\tests\GH_004929_internal_tag_constructors\test.cpp(27): error C2075: '$S1': initialization requires a brace-enclosed initializer list
I was too much of a lazy kitty for a targeted workaround, so I used the impure matrix.
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.
Fixes #4929.
Currently, these internal tagged constructors are implemented in some non-conforming manner such that they can be selected by conforming user codes. They exist for constructing containers with the stored allocators move-constructed, while the corresponding standard constructors copy-construct allocators. This PR removes the these internal tagged constructors and makes allocators copy-constructed.
Although the Standard currently requires that sometimes the allocator is move-constructed ([container.reqmts]), it's highly unusual and perhaps pointless to make move construction of an allocator type not equivalent to copy construction, because LWG-2593 requires that the move construction doesn't change the value of the source allocator. It seems that there can be different side effects can be different, but such difference can't affect further allocations.
In the future, there might be an LWG issue to allow move construction of containers to copy-construct allocators.
Affected tests - skipped during the development, unskipped later due to another approach
libcxx:
std/containers/unord/unord.map/unord.map.cnstr/move.pass.cpp
std/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp
std/containers/unord/unord.multiset/unord.multiset.cnstr/move.pass.cpp
std/containers/unord/unord.set/unord.set.cnstr/move.pass.cpp
MSVC STL:
VSO_0102478_moving_allocators