[libcxx-commits] [PATCH] D152469: [libc++] Diagnose bad iterators in the classic algorithms

Evgeny Eltsin via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 20 10:27:19 PDT 2023


eaeltsin added a comment.

Okay, we have a significant amount of failures from this, will likely require 2-3 weeks of cleanups.

What is also interesting, I see failures from compiling bits of the LLVM project itself, for example:

  TOOLCHAIN/include/c++/v1/__algorithm/for_each.h:26:3: error: static assertion failed
     26 |   _LIBCPP_REQUIRE_CPP17_INPUT_ITERATOR(_InputIterator);
        |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  TOOLCHAIN/include/c++/v1/__iterator/cpp17_iterator_concepts.h:159:72: note: expanded from macro '_LIBCPP_REQUIRE_CPP17_INPUT_ITERATOR'
    159 | #    define _LIBCPP_REQUIRE_CPP17_INPUT_ITERATOR(iter_t) static_assert(::std::__cpp17_input_iterator<iter_t>);
        |                                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  SRC/clang/lib/Basic/Sarif.cpp:89:8: note: in instantiation of function template specialization 'std::for_each<llvm::sys::path::const_iterator, (lambda at SRC/clang/lib/Basic/Sarif.cpp:89:30)>' requested here
     89 |   std::for_each(++Iter, End, [&Ret](StringRef Component) {
        |        ^
  TOOLCHAIN/include/c++/v1/__algorithm/for_each.h:26:3: note: because 'llvm::sys::path::const_iterator' does not satisfy '__cpp17_input_iterator'
     26 |   _LIBCPP_REQUIRE_CPP17_INPUT_ITERATOR(_InputIterator);
        |   ^
  TOOLCHAIN/include/c++/v1/__iterator/cpp17_iterator_concepts.h:159:72: note: expanded from macro '_LIBCPP_REQUIRE_CPP17_INPUT_ITERATOR'
    159 | #    define _LIBCPP_REQUIRE_CPP17_INPUT_ITERATOR(iter_t) static_assert(::std::__cpp17_input_iterator<iter_t>);
        |                                                                        ^
  TOOLCHAIN/include/c++/v1/__iterator/cpp17_iterator_concepts.h:87:20: note: because '(void)__lhs++' would be invalid: cannot increment value of type 'llvm::sys::path::const_iterator'
     87 |       { (void)__lhs++ };
        |                    ^
  1 error generated.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D152469



More information about the libcxx-commits mailing list