[libcxx-commits] [PATCH] D108855: [libcxx] contiguous iterator concept: don't require pointer or complete element types
Christopher Di Bella via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Aug 28 08:29:55 PDT 2021
cjdb added inline comments.
================
Comment at: libcxx/test/std/iterators/iterator.requirements/iterator.concepts/iterator.concept.random.access/contiguous_iterator.compile.pass.cpp:133
static_assert(std::random_access_iterator<wrong_iter_reference_t>);
-static_assert(!std::contiguous_iterator<wrong_iter_reference_t>);
----------------
Quuxplusone wrote:
> cjdb wrote:
> > jloser wrote:
> > > cjdb wrote:
> > > > This test needs to remain.
> > > I made this test pass by adding an `element_type` type alias to avoid the hard error in evaluating `std::to_address`. Does that work for you?
> > Thank you!
> LGTM too, mod my comment on line 107. I checked GCC and MSVC, and neither of them is SFINAE-friendly in this case, so we don't need to be SFINAE-friendly either.
> LGTM too, mod my comment on line 107. I checked GCC and MSVC, and neither of them is SFINAE-friendly in this case, so we don't need to be SFINAE-friendly either.
This comment seems to be misplaced, but I will note that just because Microsoft/STL and libstdc++ chose not to be SFINAE-friendly has no bearing on whether or not we choose to be SFINAE-friendly, if we're allowed to be.
================
Comment at: libcxx/test/std/iterators/iterator.requirements/iterator.concepts/iterator.concept.random.access/contiguous_iterator.compile.pass.cpp:167
static_assert(std::random_access_iterator<no_element_type>);
-static_assert(!std::contiguous_iterator<no_element_type>);
----------------
Quuxplusone wrote:
> cjdb wrote:
> > jloser wrote:
> > > cjdb wrote:
> > > > As does this one.
> > > I think this test is ill-formed due to the lack of an `element_type` type alias. This exposes a hard error when instantiating `std::to_address` partial specialization which is intended (and correct) behavior I believe.
> > Ack, but the test is still useful. Please move this to a verification test so we can keep it.
> Agreed that the test is ill-formed: I checked GCC and MSVC, and neither of them is SFINAE-friendly in this case, so we don't need to be SFINAE-friendly either.
> I don't see any value in checking the exact wording of Clang's error message here. I wouldn't move this test, just delete it.
>
> Delete lines 136–168. (This is a test file for `contiguous_iterator`, so there's no point in keeping any of the test case's code. In isolation, we don't care that this type happens to be a `random_access_iterator`.)
The point in checking this is to improve confidence that `std::to_address` is actually used. Please do not remove this test.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D108855/new/
https://reviews.llvm.org/D108855
More information about the libcxx-commits
mailing list