]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix typo in adjacent_view::_Iterator [PR106798]
authorPatrick Palka <ppalka@redhat.com>
Fri, 9 Sep 2022 18:56:37 +0000 (14:56 -0400)
committerPatrick Palka <ppalka@redhat.com>
Fri, 9 Sep 2022 18:56:37 +0000 (14:56 -0400)
PR libstdc++/106798

libstdc++-v3/ChangeLog:

* include/std/ranges (adjacent_view::_Iterator::_Iterator): Fix
typo.
* testsuite/std/ranges/adaptors/adjacent/1.cc (test04): New test.

libstdc++-v3/include/std/ranges
libstdc++-v3/testsuite/std/ranges/adaptors/adjacent/1.cc

index 2b8fec3c386d3b9867ca37b862981437537a76f1..37ad80ad3de9d6d9662e3e576f30c919f3ee991b 100644 (file)
@@ -5239,7 +5239,7 @@ namespace views::__adaptor
       requires _Const && convertible_to<iterator_t<_Vp>, iterator_t<_Base>>
     {
       for (size_t __j = 0; __j < _Nm; ++__j)
-       _M_current[__j] = std::move(__i[__j]);
+       _M_current[__j] = std::move(__i._M_current[__j]);
     }
 
     constexpr auto
index 9829f79364f3cd2fded6103726d5ef6da027f7e4..443c1fbf450b42e1ceafdf4afb3725431e12172c 100644 (file)
@@ -101,10 +101,22 @@ test03()
   return true;
 }
 
+constexpr bool
+test04()
+{
+  // PR libstdc++/106798
+  auto r = views::single(0) | views::lazy_split(0) | views::pairwise;
+  decltype(ranges::cend(r)) s = r.end();
+  VERIFY( r.begin() == s );
+
+  return true;
+}
+
 int
 main()
 {
   static_assert(test01());
   static_assert(test02());
   static_assert(test03());
+  static_assert(test04());
 }