aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/std
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2025-04-09 17:48:05 -0400
committerPatrick Palka <ppalka@redhat.com>2025-04-09 17:48:05 -0400
commitd69f73c0334486f3c66937388f02008736809e87 (patch)
treea4c354807539aedc903caec57e3978d0282b7c71 /libstdc++-v3/testsuite/std
parentf3862ab07943d1fc6e6a0416657ae4b7d1f3941d (diff)
downloadgcc-d69f73c0334486f3c66937388f02008736809e87.zip
gcc-d69f73c0334486f3c66937388f02008736809e87.tar.gz
gcc-d69f73c0334486f3c66937388f02008736809e87.tar.bz2
libstdc++: Fix constraint recursion in basic_const_iterator operator- [PR115046]
It was proposed in PR112490 to also adjust basic_const_iterator's friend operator-(sent, iter) overload alongside the r15-7757-g4342c50ca84ae5 adjustments to its comparison operators, but we lacked a concrete testcase demonstrating fixable constraint recursion there. It turns out Hewill Kang's PR115046 is such a testcase! So this patch makes the same adjustments to that overload as well, fixing PR115046. The LWG 4218 P/R will need to get adjusted too. PR libstdc++/115046 PR libstdc++/112490 libstdc++-v3/ChangeLog: * include/bits/stl_iterator.h (basic_const_iterator::operator-): Replace non-dependent basic_const_iterator function parameter with a dependent one of type basic_const_iterator<_It2> where _It2 matches _It. * testsuite/std/ranges/adaptors/as_const/1.cc (test04): New test. Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Diffstat (limited to 'libstdc++-v3/testsuite/std')
-rw-r--r--libstdc++-v3/testsuite/std/ranges/adaptors/as_const/1.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/std/ranges/adaptors/as_const/1.cc b/libstdc++-v3/testsuite/std/ranges/adaptors/as_const/1.cc
index 3f1f8eb..5ccf47d 100644
--- a/libstdc++-v3/testsuite/std/ranges/adaptors/as_const/1.cc
+++ b/libstdc++-v3/testsuite/std/ranges/adaptors/as_const/1.cc
@@ -69,10 +69,23 @@ test03()
auto r2 = views::as_const(views::all(v));
}
+void
+test04()
+{
+ // PR libstdc++/115046 - meta-recursion with join_view and as_const_view
+ int x[3] = {1,2,3};
+ auto v = x
+ | views::chunk(3)
+ | views::transform(views::as_const)
+ | views::join;
+ VERIFY( ranges::equal(v, x) );
+}
+
int
main()
{
static_assert(test01());
static_assert(test02());
test03();
+ test04();
}