[PATCH] D112981: Fix iterator_adaptor_base/enumerator_iter to allow composition of llvm::enumerate with llvm::make_filter_range
Mehdi AMINI via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 1 22:16:29 PDT 2021
mehdi_amini added a comment.
> Can you update the description with information on what this is fixing?
I am not sure how to phrase this, the first error was:
/llvm/include/llvm/ADT/iterator.h:299:41: error: binding reference of type 'result_pair<...>' to value of type 'const result_pair<...>' drops 'const' qualifier
ReferenceT operator*() const { return *I; }
^~
llvm/unittests/ADT/IteratorTest.cpp:186:26: note: in instantiation of member function 'llvm::iterator_adaptor_base<llvm::filter_iterator_base<llvm::detail::enumerator_iter<int (&)[7]>, (lambda at llvm/unittests/ADT/IteratorTest.cpp:182:16), std::forward_iterator_tag>, llvm::detail::enumerator_iter<int (&)[7]>, std::forward_iterator_tag, llvm::detail::result_pair<int (&)[7]>, long, int *, llvm::detail::result_pair<int (&)[7]> &>::operator*' requested here
for (auto IndexedValue : make_filter_range(Enumerate, IsOdd))
^
The fix in STLExtra is for:
llvm/unittests/ADT/IteratorTest.cpp:187:34: error: member reference base type 'int' is not a structure or union
Actual.push_back(IndexedValue.value());
~~~~~~~~~~~~^~~~~~
In file included from llvm/unittests/ADT/IteratorTest.cpp:10:
llvm/include/llvm/ADT/iterator.h:300:35: error: non-const lvalue reference to type 'int' cannot bind to a value of unrelated type 'llvm::detail::enumerator_iter<int (&)[7]>::result_type' (aka 'result_pair<int (&)[7]>')
ReferenceT operator*() { return *I; }
^~
llvm/unittests/ADT/IteratorTest.cpp:186:26: note: in instantiation of member function 'llvm::iterator_adaptor_base<llvm::filter_iterator_base<llvm::detail::enumerator_iter<int (&)[7]>, (lambda at llvm/unittests/ADT/IteratorTest.cpp:182:16), std::forward_iterator_tag>, llvm::detail::enumerator_iter<int (&)[7]>, std::forward_iterator_tag, llvm::detail::result_pair<int (&)[7]>, long, int *, int &>::operator*' requested here
for (auto IndexedValue : make_filter_range(Enumerate, IsOdd))
^
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D112981/new/
https://reviews.llvm.org/D112981
More information about the llvm-commits
mailing list