Issue 75611
Summary [libc++] `views::take` behaves incorrectly for `iota_view`
Labels libc++
Assignees
Reporter frederick-vs-ja
    Discovered in analysis for microsoft/STL#4263.

https://github.com/llvm/llvm-project/blob/214d32ccd2be05262a328563d3792ec0d36404b0/libcxx/include/__ranges/take_view.h#L290-L303

Currently, when libc++'s `views::take` specially handles an `iota_view`, the addition is done after deference the beginning iterator.
However, in [[range.take.overview]/2.3](https://eel.is/c++draft/range.take.overview#2.3), the deferencing is done after addition, which means that the standard requires the returned `iota_view` to have the same `W` and `Bound` type in such cases.

https://github.com/llvm/llvm-project/blob/214d32ccd2be05262a328563d3792ec0d36404b0/libcxx/test/std/ranges/range.adaptors/range.take/adaptor.pass.cpp#L177

Also, the test file is testing the incorrect behavior.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to