summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/25_algorithms
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2021-11-01 12:27:43 +0000
committerJonathan Wakely <jwakely@redhat.com>2021-11-01 21:01:31 +0000
commit6f34b9e4f1eb7aa3398aaf135cbb24680eaad1b1 (patch)
treea2ae7e4a3bc2d5cea04d61d8eb9c9fec115dc8e7 /libstdc++-v3/testsuite/25_algorithms
parent09bc98098e4ad474d2ba9da52457b29bbd08874b (diff)
downloadgcc-6f34b9e4f1eb7aa3398aaf135cbb24680eaad1b1.tar.gz
libstdc++: Missing constexpr for __gnu_debug::__valid_range etc
The new 25_algorithms/move/constexpr.cc test fails in debug mode, because the debug assertions use the non-constexpr overloads in <debug/stl_iterator.h>. libstdc++-v3/ChangeLog: * include/debug/stl_iterator.h (__valid_range): Add constexpr for C++20. Qualify call to avoid ADL. (__get_distance, __can_advance, __unsafe, __base): Likewise. * testsuite/25_algorithms/move/constexpr.cc: Also check with std::reverse_iterator arguments.
Diffstat (limited to 'libstdc++-v3/testsuite/25_algorithms')
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/move/constexpr.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/25_algorithms/move/constexpr.cc b/libstdc++-v3/testsuite/25_algorithms/move/constexpr.cc
index 773c55cfb50..eb1f3b17e72 100644
--- a/libstdc++-v3/testsuite/25_algorithms/move/constexpr.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/move/constexpr.cc
@@ -17,3 +17,14 @@ test01()
}
static_assert(test01());
+
+constexpr bool
+test02()
+{
+ int x[2] = {1,2}, y[2];
+ std::span in(x), out(y);
+ std::move(in.rbegin(), in.rend(), out.rbegin());
+ return std::equal(in.rbegin(), in.rend(), out.rbegin());
+}
+
+static_assert(test02());