[libcxx-commits] [libcxx] [libc++][test] enable_borrowed_range compile -> verify for ranges::as_rvalue_view (PR #75066)
Mark de Wever via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Dec 24 03:22:56 PST 2023
================
@@ -7,10 +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>>>);
-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>>>>);
+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>>>>);
----------------
mordante wrote:
```suggestion
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>>>>);
```
Clang-format doesn't do this manually since removing the space in templates can be an issue in C++03.
https://github.com/llvm/llvm-project/pull/75066
More information about the libcxx-commits
mailing list