[libcxx-commits] [libcxx] [libc++][ranges] Implement LWG4053 and LWG4054 (PR #88612)
via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Apr 15 08:56:03 PDT 2024
================
@@ -60,6 +60,14 @@ static_assert(!std::is_invocable_v<decltype(std::views::repeat), NonCopyable>);
// Tp is move_constructible
static_assert(std::is_invocable_v<decltype(std::views::repeat), MoveOnly>);
+// LWG4053: Unary call to std::views::repeat does not decay the argument
+using RPV = std::ranges::repeat_view<const char*>;
+
+static_assert(std::same_as<decltype(std::views::repeat("foo", std::unreachable_sentinel)), RPV>); // OK
+static_assert(std::same_as<decltype(std::views::repeat(+"foo", std::unreachable_sentinel)), RPV>); // OK
+static_assert(std::same_as<decltype(std::views::repeat("foo")), RPV>); // OK since LWG4053
+static_assert(std::same_as<decltype(std::views::repeat(+"foo")), RPV>); // OK
----------------
yronglin wrote:
Does the follow case also well-formed?
```
static_assert(std::same_as<decltype(std::ranges::repeat_view(std::ranges::repeat_view(1))), std::ranges::repeat_view<std::ranges::repeat_view<int>>>);
```
https://github.com/llvm/llvm-project/pull/88612
More information about the libcxx-commits
mailing list