[libcxx-commits] [PATCH] D118963: [libc++] No longer support ranges::begin(x) when x is an array of incomplete type.

Konstantin Varlamov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Feb 3 22:05:48 PST 2022


var-const added inline comments.


================
Comment at: libcxx/include/__ranges/access.h:73
+      return __t + 0;
     }
 
----------------
Quuxplusone wrote:
> The use of `_Tp (&__t)[]` here instead of `is_array_v` is both for symmetry with `ranges::end`, //and// because we need to make sure that we never try to evaluate `*__t` before we're absolutely sure that `__t` is an array type (because if it's a class type, that'll do ADL and we don't want ADL).
> `__t + 0` could be just `__t` AFAIK, but the standard says `__t + 0` and I can't see any way for that to hurt anything.
Question: why do we need to do `sizeof(*__t)` rather than `sizeof(_Tp)`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118963



More information about the libcxx-commits mailing list