[libcxx-commits] [libcxx] [libc++][ranges] Implement LWG4053 and LWG4054 (PR #88612)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Apr 16 05:01:16 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:

Thank you for your confirmation!

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


More information about the libcxx-commits mailing list