From: Patrick Palka <ppalka@redhat.com>
To: gcc-patches@gcc.gnu.org
Cc: libstdc++@gcc.gnu.org, Patrick Palka <ppalka@redhat.com>
Subject: [PATCH 2/3] libstdc++: Fix typo in adjacent_view::_Iterator [PR106798]
Date: Fri, 9 Sep 2022 13:24:45 -0400 [thread overview]
Message-ID: <20220909172446.1546805-2-ppalka@redhat.com> (raw)
In-Reply-To: <20220909172446.1546805-1-ppalka@redhat.com>
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 | 2 +-
.../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());
}
--
2.37.3.518.g79f2338b37
next prev parent reply other threads:[~2022-09-09 17:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-09 17:24 [PATCH 1/3] libstdc++: Fix zip_view's operator- for integer-class difference type [PR106766] Patrick Palka
2022-09-09 17:24 ` Patrick Palka [this message]
2022-09-09 18:26 ` [PATCH 2/3] libstdc++: Fix typo in adjacent_view::_Iterator [PR106798] Jonathan Wakely
2022-09-09 17:24 ` [PATCH 3/3] libstdc++: Fix return type of empty zip/adjacent_transform [PR106803] Patrick Palka
2022-09-09 18:29 ` Jonathan Wakely
2022-09-09 18:26 ` [PATCH 1/3] libstdc++: Fix zip_view's operator- for integer-class difference type [PR106766] Jonathan Wakely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220909172446.1546805-2-ppalka@redhat.com \
--to=ppalka@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=libstdc++@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).