[libcxx-commits] [libcxx] [libc++][test] enable_borrowed_range compile -> verify for ranges::as_rvalue_view (PR #75066)

Will Hawkins via libcxx-commits libcxx-commits at lists.llvm.org
Mon Dec 11 12:21:16 PST 2023


https://github.com/hawkinsw updated https://github.com/llvm/llvm-project/pull/75066

>From 6bbc832b3ce7eb027a8c12143cb78a9174a24217 Mon Sep 17 00:00:00 2001
From: Will Hawkins <hawkinsw at obs.cr>
Date: Mon, 11 Dec 2023 11:30:21 -0500
Subject: [PATCH 1/2] [libc++][test] enable_borrowed_range compile -> verify
 for ranges::as_rvalue_view

Rename (and fixup) file containing the enable_borrowed_range tests for ranges::as_rvalue_view by converting to verify test.
---
 .../enable_borrowed_range.compile.pass.cpp    | 16 ----------------
 .../enable_borrowed_range.verify.cpp          | 19 +++++++++++++++++++
 2 files changed, 19 insertions(+), 16 deletions(-)
 delete mode 100644 libcxx/test/std/ranges/range.adaptors/range.as.rvalue/enable_borrowed_range.compile.pass.cpp
 create mode 100644 libcxx/test/std/ranges/range.adaptors/range.as.rvalue/enable_borrowed_range.verify.cpp

diff --git a/libcxx/test/std/ranges/range.adaptors/range.as.rvalue/enable_borrowed_range.compile.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.as.rvalue/enable_borrowed_range.compile.pass.cpp
deleted file mode 100644
index 48d1d96b02482..0000000000000
--- a/libcxx/test/std/ranges/range.adaptors/range.as.rvalue/enable_borrowed_range.compile.pass.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-
-#include <ranges>
-#include <vector>
-
-static_assert(std::ranges::enable_borrowed_range<std::ranges::as_rvalue_view<std::ranges::empty_view<int>>>);
-static_assert(std::ranges::enable_borrowed_range<std::ranges::as_rvalue_view<std::views::all_t<std::vector<int>&>>>);
-static_assert(!std::ranges::enable_borrowed_range<std::ranges::as_rvalue_view<std::views::all_t<std::vector<int>>>>);
diff --git a/libcxx/test/std/ranges/range.adaptors/range.as.rvalue/enable_borrowed_range.verify.cpp b/libcxx/test/std/ranges/range.adaptors/range.as.rvalue/enable_borrowed_range.verify.cpp
new file mode 100644
index 0000000000000..184d2dac57e15
--- /dev/null
+++ b/libcxx/test/std/ranges/range.adaptors/range.as.rvalue/enable_borrowed_range.verify.cpp
@@ -0,0 +1,19 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+#include <ranges>
+#include <vector>
+
+static_assert(std::ranges::enable_borrowed_range<
+              std::ranges::as_rvalue_view<std::ranges::empty_view<int>>>); // expected-no-diagnostics
+static_assert(std::ranges::enable_borrowed_range<
+              std::ranges::as_rvalue_view<std::views::all_t<std::vector<int>&>>>); // expected-no-diagnostics
+static_assert(!std::ranges::enable_borrowed_range<
+              std::ranges::as_rvalue_view<std::views::all_t<std::vector<int>>>>); // expected-no-diagnostics

>From 8d748f0129bb242b7af5cf1b0ef51e6f696cb58e Mon Sep 17 00:00:00 2001
From: Will Hawkins <hawkinsw at obs.cr>
Date: Mon, 11 Dec 2023 15:21:03 -0500
Subject: [PATCH 2/2] fixup! [libc++][test] enable_borrowed_range compile ->
 verify for ranges::as_rvalue_view

Only need one expected-no-diagnostics directive.
---
 .../range.as.rvalue/enable_borrowed_range.verify.cpp   | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/libcxx/test/std/ranges/range.adaptors/range.as.rvalue/enable_borrowed_range.verify.cpp b/libcxx/test/std/ranges/range.adaptors/range.as.rvalue/enable_borrowed_range.verify.cpp
index 184d2dac57e15..c6a10a2939c54 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.as.rvalue/enable_borrowed_range.verify.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.as.rvalue/enable_borrowed_range.verify.cpp
@@ -7,13 +7,11 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+// expected-no-diagnostics
 
 #include <ranges>
 #include <vector>
 
-static_assert(std::ranges::enable_borrowed_range<
-              std::ranges::as_rvalue_view<std::ranges::empty_view<int>>>); // expected-no-diagnostics
-static_assert(std::ranges::enable_borrowed_range<
-              std::ranges::as_rvalue_view<std::views::all_t<std::vector<int>&>>>); // expected-no-diagnostics
-static_assert(!std::ranges::enable_borrowed_range<
-              std::ranges::as_rvalue_view<std::views::all_t<std::vector<int>>>>); // expected-no-diagnostics
+static_assert(std::ranges::enable_borrowed_range< std::ranges::as_rvalue_view<std::ranges::empty_view<int>>>);
+static_assert(std::ranges::enable_borrowed_range< std::ranges::as_rvalue_view<std::views::all_t<std::vector<int>&>>>);
+static_assert(!std::ranges::enable_borrowed_range< std::ranges::as_rvalue_view<std::views::all_t<std::vector<int>>>>);



More information about the libcxx-commits mailing list