[libcxx-commits] [PATCH] D115838: [libc++] [ranges] Remove the static_assert from ranges::begin and ranges::end.
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Dec 20 08:36:13 PST 2021
ldionne accepted this revision.
ldionne added a comment.
This revision is now accepted and ready to land.
We seem to be missing a libc++ specific test for the extension that we return the start of the array when calling `ranges::begin(incomplete)`.
LGTM except for that nit.
================
Comment at: libcxx/include/__ranges/access.h:127-131
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp (&__t)[_Np]) const noexcept
+ requires requires { __t + _Np; }
+ {
+ return __t + _Np;
}
----------------
Quuxplusone wrote:
> I needed to add this `requires` (or, I could add `-> decltype(__t + _Np)` if you'd rather ;)) because otherwise this hard-errors when you try to call it on an array of incomplete type.
> I actually suspect that what I've got here might hit the same https://gcc.gnu.org/bugzilla//show_bug.cgi?id=103700 that I worked around in `ranges::begin`. If so, then I'm not sure what we should do.
I think I'd rather use `-> decltype(__t + _Np)` and not acknowledge explicitly that we're treating incomplete types any special way here.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115838/new/
https://reviews.llvm.org/D115838
More information about the libcxx-commits
mailing list