[libcxx-commits] [PATCH] D108855: [libcxx] contiguous iterator concept: don't require pointer or complete element types

Joe Loser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Aug 28 21:35:02 PDT 2021


jloser added inline comments.


================
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>);
 
----------------
cjdb wrote:
> 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.
I added a new test file expecting the appropriate note/errors around use of `std::to_address` when evaluating `std::contiguous_iterator` concept for a type that is missing an `element_type` type alias.


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