Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Aug 3, 2022

Conversation

CaseyCarter
Copy link
Member

...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 CaseyCarter added bug Something isn't working ranges C++20/23 ranges labels Jul 28, 2022
@CaseyCarter CaseyCarter requested a review from a team as a code owner July 28, 2022 19:01
@strega-nil-ms strega-nil-ms self-assigned this Jul 28, 2022
@@ -275,7 +275,7 @@ struct memcpy_test {

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
Member 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 StephanTLavavej self-assigned this Aug 3, 2022
@StephanTLavavej
Copy link
Member

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

@StephanTLavavej StephanTLavavej merged commit 9567121 into microsoft:main Aug 3, 2022
@StephanTLavavej
Copy link
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