Skip to content

Pass rvalues to _Seek_to in ranges::uninitialized_(copy|move)_n - #2964

Merged
Stephan T. Lavavej (StephanTLavavej) merged 1 commit into
microsoft:mainfrom
CaseyCarter:gh-2962
Aug 3, 2022
Merged

Pass rvalues to _Seek_to in ranges::uninitialized_(copy|move)_n#2964
Stephan T. Lavavej (StephanTLavavej) merged 1 commit into
microsoft:mainfrom
CaseyCarter:gh-2962

Conversation

@CaseyCarter

Copy link
Copy Markdown
Contributor

...as is necessary to properly unwrap-and-rewrap input iterators. Test ranges::uninitialized_(copy|move)(_n)? with iterators that require rvalues to unwrap properly which would have caught this bug.

Fixes #2962.

...as is necessary to properly unwrap-and-rewrap input iterators. Test `ranges::uninitialized_(copy|move)(_n)?` with iterators that require rvalues to unwrap properly which would have caught this bug.

Fixes microsoft#2962.
@CaseyCarter Casey Carter (CaseyCarter) added bug Something isn't working ranges C++20/23 ranges labels Jul 28, 2022
@CaseyCarter
Casey Carter (CaseyCarter) requested a review from a team as a code owner July 28, 2022 19:01
template <test::ProxyRef IsProxy>
using test_input = test::range<test::input, int_wrapper, test::Sized::no, test::CanDifference::no, test::Common::no,
test::CanCompare::yes, IsProxy>;
test::CanCompare::no, IsProxy>;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This CanCompare argument directly controls whether the range's iterators can be compared to each other with == and !=, and also happens to determine whether iterators are copyable. We want move-only iterators here since they only rewrap rvalues which would fail to compile without the fix to the product code.

@StephanTLavavej

Copy link
Copy Markdown
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej
Stephan T. Lavavej (StephanTLavavej) merged commit 9567121 into microsoft:main Aug 3, 2022
@StephanTLavavej

Copy link
Copy Markdown
Member

Thanks for fixing this bug and enhancing the test coverage! 🐞 😸 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ranges C++20/23 ranges

Projects

None yet

Development

Successfully merging this pull request may close these issues.

<memory>: ranges::uninitialized_move_n and ranges::uninitialized_copy_n missing move to rewrap input_iterator

4 participants