[libcxx-commits] [libcxx] [libc++][ranges] Implement LWG4053 'Unary call to std::views::repeat does not decay the argument' (PR #88612)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Sun Apr 14 18:24:04 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
----------------
frederick-vs-ja wrote:

These cases are actually covered by the resolution of LWG4054. As both LWG4053 and LWG4054 are accepted, the resolution of LWG4053 only affects CTAD.

I think these lines should be moved to PR #88606, and `ctad.compile.pass.cpp` should be modified in this PR.

https://github.com/llvm/llvm-project/pull/88612


More information about the libcxx-commits mailing list