public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-2568] libstdc++: Fix typo in adjacent_view::_Iterator [PR106798]
@ 2022-09-09 19:05 Patrick Palka
  0 siblings, 0 replies; only message in thread
From: Patrick Palka @ 2022-09-09 19:05 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

https://gcc.gnu.org/g:e469506b7fdd1bf2c958ca3140573a474fcba3b8

commit r13-2568-ge469506b7fdd1bf2c958ca3140573a474fcba3b8
Author: Patrick Palka <ppalka@redhat.com>
Date:   Fri Sep 9 14:56:37 2022 -0400

    libstdc++: Fix typo in adjacent_view::_Iterator [PR106798]
    
            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.

Diff:
---
 libstdc++-v3/include/std/ranges                          |  2 +-
 libstdc++-v3/testsuite/std/ranges/adaptors/adjacent/1.cc | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges
index 2b8fec3c386..37ad80ad3de 100644
--- a/libstdc++-v3/include/std/ranges
+++ b/libstdc++-v3/include/std/ranges
@@ -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
diff --git a/libstdc++-v3/testsuite/std/ranges/adaptors/adjacent/1.cc b/libstdc++-v3/testsuite/std/ranges/adaptors/adjacent/1.cc
index 9829f79364f..443c1fbf450 100644
--- a/libstdc++-v3/testsuite/std/ranges/adaptors/adjacent/1.cc
+++ b/libstdc++-v3/testsuite/std/ranges/adaptors/adjacent/1.cc
@@ -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());
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-09-09 19:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-09 19:05 [gcc r13-2568] libstdc++: Fix typo in adjacent_view::_Iterator [PR106798] Patrick Palka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).