[libcxx-commits] [PATCH] D141699: [libc++][ranges] Implement P2474R2(`views::repeat`).

Yurong via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Feb 22 08:50:08 PST 2023


yronglin added a comment.

In D141699#4142079 <https://reviews.llvm.org/D141699#4142079>, @Mordante wrote:

> In D141699#4139140 <https://reviews.llvm.org/D141699#4139140>, @yronglin wrote:
>
>> Seems this is an issue in older version clang(https://godbolt.org/z/PsqzMq3q8), should we disable this test in older version clang or use other workarounds, WDYT? @Mordante 
>> @philnik
>>
>>   struct A {
>>     int x_;
>>     int y_;
>>   };
>>   
>>   constexpr bool test() {
>>     std::ranges::repeat_view<A, int> rv(std::piecewise_construct, std::tuple{1, 2}, std::tuple{3});
>>     assert(rv.size() == 3);
>>     assert(rv[0].x_ == 1);
>>     assert(rv[0].y_ == 2);
>>     assert(std::ranges::next(rv.begin(), 3) == rv.end());
>>   
>>     return true;
>>   }
>
> I haven't looked closely at the error, but might it be that this code requires P0960? That paper was implemented in Clang 16.
>
> Disabling the test due to lack of compiler support is acceptable. When it's possible to introduce a work-around for Clang 15 that would be preferred.
>
> [P0960] https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0960r3.html

@Mordante Thanks a lot! You are correct, repeat_view requires P0960, I have tried to revert 95a4c0c83554c025ef709a6805e67233d0dedba0 <https://reviews.llvm.org/rG95a4c0c83554c025ef709a6805e67233d0dedba0> in clang trunk, and this code was rejected by clang, so I have added a workaround.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141699/new/

https://reviews.llvm.org/D141699



More information about the libcxx-commits mailing list