[libcxx-commits] [PATCH] D115806: [libc++] Remove incorrect default constructor in cpp17_input_iterator

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Dec 15 08:33:49 PST 2021


ldionne created this revision.
ldionne added a reviewer: Quuxplusone.
ldionne requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

AFAICT, Cpp17InputIterators are not required to be default constructible,
so our archetype should not be default constructible. Removing that
constructor has a ripple effect on a couple of tests that were making
incorrect assumptions. Notably:

- Some tests were using cpp17_input_iterator to form a common_range using test_common_range. That is not valid, because a cpp17_input_iterator is not a sentinel for itself after the change (it's not semiregular anymore).

- Some tests were using cpp17_input_iterator as a sentinel for itself (basically the same problem as above), which is invalid for the same reason.

- This change required modifying sentinel_wrapper so that it can work with non-default-constructible iterators like cpp17_input_iterator. Otherwise, there would be no way to test most utilities on those iterators.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115806

Files:
  libcxx/test/std/ranges/range.adaptors/range.join.view/iterator/ctor.default.pass.cpp
  libcxx/test/std/ranges/range.adaptors/range.join.view/iterator/member_types.compile.pass.cpp
  libcxx/test/std/ranges/range.req/range.range/sentinel_t.compile.pass.cpp
  libcxx/test/std/ranges/range.req/range.refinements/common_range.compile.pass.cpp
  libcxx/test/std/ranges/range.req/range.refinements/input_range.compile.pass.cpp
  libcxx/test/std/ranges/range.utility/range.subrange/advance.pass.cpp
  libcxx/test/support/test_iterators.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115806.394583.patch
Type: text/x-patch
Size: 9997 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211215/eea659d4/attachment-0001.bin>


More information about the libcxx-commits mailing list