aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/testsuite')
-rw-r--r--libstdc++-v3/testsuite/24_iterators/indirect_callable/p2997r1.cc37
-rw-r--r--libstdc++-v3/testsuite/std/ranges/headers/ranges/synopsis.cc6
-rw-r--r--libstdc++-v3/testsuite/std/ranges/version_c++23.cc70
3 files changed, 42 insertions, 71 deletions
diff --git a/libstdc++-v3/testsuite/24_iterators/indirect_callable/p2997r1.cc b/libstdc++-v3/testsuite/24_iterators/indirect_callable/p2997r1.cc
new file mode 100644
index 0000000..6a66b0f
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/indirect_callable/p2997r1.cc
@@ -0,0 +1,37 @@
+// Test the example from P2997R1 "Removing the common reference requirement
+// from the indirectly invocable concepts".
+// { dg-do compile { target c++20 } }
+
+#include <algorithm>
+#include <ranges>
+
+struct C {
+ auto f() -> void;
+};
+
+struct Iterator {
+ using value_type = C;
+ using difference_type = std::ptrdiff_t;
+ using iterator_category = std::input_iterator_tag;
+
+ auto operator*() const -> C&&;
+ auto operator++() -> Iterator&;
+ auto operator++(int) -> void;
+ auto operator==(Iterator const&) const -> bool;
+};
+
+static_assert(std::input_iterator<Iterator>);
+static_assert(std::same_as<std::iter_value_t<Iterator>, C>);
+static_assert(std::same_as<std::iter_reference_t<Iterator>, C&&>);
+
+struct R {
+ auto begin() -> Iterator;
+ auto end() -> Iterator;
+};
+
+static_assert(std::ranges::range<R>);
+static_assert(std::same_as<std::ranges::range_reference_t<R>, C&&>);
+
+auto f(R r) -> void {
+ std::ranges::for_each(r, [](auto&& c){ c.f(); });
+}
diff --git a/libstdc++-v3/testsuite/std/ranges/headers/ranges/synopsis.cc b/libstdc++-v3/testsuite/std/ranges/headers/ranges/synopsis.cc
index 48f53b6..d359039 100644
--- a/libstdc++-v3/testsuite/std/ranges/headers/ranges/synopsis.cc
+++ b/libstdc++-v3/testsuite/std/ranges/headers/ranges/synopsis.cc
@@ -22,7 +22,11 @@
#ifndef __cpp_lib_ranges
# error "Feature test macro for ranges is missing in <ranges>"
-#elif __cpp_lib_ranges < 201911L
+#elif __cplusplus > 202302L && __cpp_lib_ranges != 202406L
+# error "Feature test macro for ranges has wrong value in <ranges>"
+#elif __cplusplus == 202302L && __cpp_lib_ranges != 202302L
+# error "Feature test macro for ranges has wrong value in <ranges>"
+#elif __cplusplus == 202002L && __cpp_lib_ranges != 202110L
# error "Feature test macro for ranges has wrong value in <ranges>"
#endif
diff --git a/libstdc++-v3/testsuite/std/ranges/version_c++23.cc b/libstdc++-v3/testsuite/std/ranges/version_c++23.cc
deleted file mode 100644
index 0187115..0000000
--- a/libstdc++-v3/testsuite/std/ranges/version_c++23.cc
+++ /dev/null
@@ -1,70 +0,0 @@
-// { dg-do preprocess { target c++23 } }
-// { dg-add-options no_pch }
-
-#include <version>
-
-#if __STDC_HOSTED__
-# if __cpp_lib_ranges != 202302L
-# error "Feature-test macro __cpp_lib_ranges has wrong value in <version>"
-# endif
-#endif
-
-#if __cpp_lib_ranges_zip != 202110L
-# error "Feature-test macro __cpp_lib_ranges_zip has wrong value in <version>"
-#endif
-
-#if __cpp_lib_ranges_chunk != 202202L
-# error "Feature-test macro __cpp_lib_ranges_chunk has wrong value in <version>"
-#endif
-
-#if __cpp_lib_ranges_slide != 202202L
-# error "Feature-test macro __cpp_lib_ranges_slide has wrong value in <version>"
-#endif
-
-#if __cpp_lib_ranges_chunk_by != 202202L
-# error "Feature-test macro __cpp_lib_ranges_chunk_by has wrong value in <version>"
-#endif
-
-#if __cpp_lib_ranges_join_with != 202202L
-# error "Feature-test macro __cpp_lib_ranges_join_with has wrong value in <version>"
-#endif
-
-#if __cpp_lib_ranges_repeat != 202207L
-# error "Feature-test macro __cpp_lib_ranges_repeat has wrong value in <version>"
-#endif
-
-#if __cpp_lib_ranges_stride != 202207L
-# error "Feature-test macro __cpp_lib_ranges_stride has wrong value in <version>"
-#endif
-
-#if __cpp_lib_ranges_cartesian_product != 202207L
-# error "Feature-test macro __cpp_lib_ranges_cartesian_product has wrong value in <version>"
-#endif
-
-#if __cpp_lib_ranges_as_rvalue != 202207L
-# error "Feature-test macro __cpp_lib_ranges_as_rvalue has wrong value in <version>"
-#endif
-
-#if __cpp_lib_ranges_as_const != 202311L
-# error "Feature-test macro __cpp_lib_ranges_as_const has wrong value in <version>"
-#endif
-
-#if __cpp_lib_ranges_enumerate != 202302L
-# error "Feature-test macro __cpp_lib_ranges_enumerate has wrong value in <version>"
-#endif
-
-#if __cpp_lib_ranges_contains != 202207L
-# error "Feature-test macro __cpp_lib_ranges_contains has wrong value in <version>"
-#endif
-
-#if __cpp_lib_ranges_iota != 202202L
-# error "Feature-test macro __cpp_lib_ranges_iota has wrong value in <version>"
-#endif
-
-#if __cpp_lib_ranges_find_last != 202207L
-# error "Feature-test macro __cpp_lib_ranges_find_last has wrong value in <version>"
-#endif
-
-#if __cpp_lib_ranges_fold != 202207L
-# error "Feature-test macro __cpp_lib_ranges_fold has wrong value in <version>"
-#endif