[libcxx-commits] [libcxx] [libc++][ranges] Implement LWG4053 and LWG4054 (PR #88612)
A. Jiang via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Apr 15 20:51:25 PDT 2024
================
@@ -24,4 +24,7 @@ static_assert(std::same_as<decltype(std::ranges::repeat_view(std::declval<Empty&
static_assert(std::same_as<decltype(std::ranges::repeat_view(10, 1)), std::ranges::repeat_view<int, int>>);
static_assert(std::same_as<decltype(std::ranges::repeat_view(10, 1U)), std::ranges::repeat_view<int, unsigned>>);
static_assert(std::same_as<decltype(std::ranges::repeat_view(10, 1UL)), std::ranges::repeat_view<int, unsigned long>>);
+
+// LWG4053 and LWG4054 "Repeating a repeat_view should repeat the view"
+static_assert(std::same_as<decltype(std::views::repeat(std::views::repeat(1))), std::ranges::repeat_view<std::ranges::repeat_view<int>>>);
----------------
frederick-vs-ja wrote:
IIUC this line is not testing CTAD.
```suggestion
using RPV = std::ranges::repeat_view<const char*>;
static_assert(std::same_as<decltype(std::ranges::repeat_view("foo", std::unreachable_sentinel)), RPV>); // OK
static_assert(std::same_as<decltype(std::ranges::repeat_view(+"foo", std::unreachable_sentinel)), RPV>); // OK
static_assert(std::same_as<decltype(std::ranges::repeat_view("foo")), RPV>); // OK since LWG4053
static_assert(std::same_as<decltype(std::ranges::repeat_view(+"foo")), RPV>); // OK
```
https://github.com/llvm/llvm-project/pull/88612
More information about the libcxx-commits
mailing list