Add default constructurs to `filter_iterator_impl` and `filter_iterator_impl`.
authorJens Massberg <massberg@google.com>
Thu, 12 Jan 2023 10:43:08 +0000 (11:43 +0100)
committerJens Massberg <massberg@google.com>
Fri, 13 Jan 2023 15:44:48 +0000 (16:44 +0100)
Bases of `reverse_iterator` must be default-constructible. This is enforced when using `libstdc++-12` plus C++20.

Differential Revision: https://reviews.llvm.org/D141587

llvm/include/llvm/ADT/STLExtras.h

index 1354268..be8800c 100644 (file)
@@ -524,6 +524,8 @@ protected:
       BaseT::operator++();
   }
 
+  filter_iterator_base() = default;
+
   // Construct the iterator. The begin iterator needs to know where the end
   // is, so that it can properly stop when it gets there. The end iterator only
   // needs the predicate to support bidirectional iteration.
@@ -559,6 +561,8 @@ template <typename WrappedIteratorT, typename PredicateT,
 class filter_iterator_impl
     : public filter_iterator_base<WrappedIteratorT, PredicateT, IterTag> {
 public:
+  filter_iterator_impl() = default;
+
   filter_iterator_impl(WrappedIteratorT Begin, WrappedIteratorT End,
                        PredicateT Pred)
       : filter_iterator_impl::filter_iterator_base(Begin, End, Pred) {}
@@ -580,6 +584,8 @@ class filter_iterator_impl<WrappedIteratorT, PredicateT,
 public:
   using BaseT::operator--;
 
+  filter_iterator_impl() = default;
+
   filter_iterator_impl(WrappedIteratorT Begin, WrappedIteratorT End,
                        PredicateT Pred)
       : BaseT(Begin, End, Pred) {}