[libcxx-commits] [PATCH] D117449: [libcxx] Constrain common_iterator's iterator_traits specialization

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jan 17 07:13:06 PST 2022


Quuxplusone accepted this revision as: Quuxplusone.
Quuxplusone added a comment.

Nice catch! That test is a mess, though. I don't object to landing this as-is, just to fix the bug; I would also be happy to merge it into D117400 <https://reviews.llvm.org/D117400>. Your call.



================
Comment at: libcxx/test/std/iterators/predef.iterators/iterators.common/iterator_traits.compile.pass.cpp:55
+    static_assert(!HasIteratorConcept<IterTraits>);
+    static_assert(std::same_as<IterTraits::iterator_category, std::output_iterator_tag>);
+    static_assert(std::same_as<IterTraits::value_type, void>);
----------------
Well this is weird. `non_const_deref_iterator<int*>::iterator_category` appears to be `input_iterator_tag`, but `std::common_iterator<Iter, sentinel_type<int*>>` is an output iterator instead?

Also, I'm seeing now that `non_const_deref_iterator` is a template, but it's used in only one place (with `int*`), so it can be massively simplified. Would you like me to just take this over and merge it into my existing D117400?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117449



More information about the libcxx-commits mailing list