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

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Feb 3 18:46:25 PST 2022


Quuxplusone created this revision.
Quuxplusone added reviewers: var-const, ldionne, jloser, philnik, libc++.
Quuxplusone added a project: libc++.
Quuxplusone requested review of this revision.
Herald added a subscriber: libcxx-commits.
Herald added 1 blocking reviewer(s): libc++.

var-const points out that `ranges::begin` is (non-normatively but explicitly) always supposed to return a `std::input_or_output_iterator`, and `Incomplete*` is not a `std::input_or_output_iterator` because it has no `operator++`. Therefore, we should never return `Incomplete*` from `ranges::begin(x)`, even when `x` is `Incomplete(&)[]`. Instead, just SFINAE away.

(The note in question: https://eel.is/c++draft/range.access.begin#4 "Whenever `ranges​::​begin(E)` is a valid expression, its type models `input_­or_­output_­iterator`.")


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D118963

Files:
  libcxx/include/__ranges/access.h
  libcxx/test/libcxx/ranges/range.access/begin.incomplete_type.sh.cpp
  libcxx/test/std/ranges/range.access/begin.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118963.405854.patch
Type: text/x-patch
Size: 5795 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220204/1eacbfa3/attachment.bin>


More information about the libcxx-commits mailing list