[libcxx-commits] [PATCH] D100255: [libcxx][ranges] adds `range` access CPOs

Christopher Di Bella via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Apr 30 09:51:12 PDT 2021


cjdb added a comment.

Most of Zoe's comments have been applied just before merging with main.



================
Comment at: libcxx/test/std/ranges/range.access/range.access.begin/incomplete.compile.verify.cpp:28
+  struct incomplete;
+  f<incomplete(&)[10]>();
+  // expected-error@*:* {{"`std::ranges::begin` is SFINAE-unfriendly on arrays of an incomplete type."}}
----------------
zoecarver wrote:
> cjdb wrote:
> > zoecarver wrote:
> > > I think it would make more sense to call `std::ranges::begin` directly here. Certainly don't use `__begin::__fn`, especially if it's not in a libc++ test (which this probably shouldn't be anyway).
> > Do you mean something like `static_assert(requires { std::ranges::begin(std::declval<incomplete(&)[]>()) });`?
> No I mean you could do something like:
> ```
> void test(incomplete(&arg)[]) {
>   std::ranges::begin(arg);
> }
> ```
> Or
> 
> ```
> std::ranges::begin(std::declval<incomplete(&)[]>());
> ```
> This is how someone is actually going to be using the function object when we expect to see the error. 
> 
> Anyway, this isn't a big deal so either way is fine. 
Since this is a test for SFINAE friendliness, I don't think I can achieve that (I did try).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100255



More information about the libcxx-commits mailing list