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

Zoe Carver via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Apr 30 08:18:04 PDT 2021


zoecarver added a comment.

Let's land this!



================
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."}}
----------------
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. 


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