From 82239c42f9d8f85e682d717fe975e4d102393d79 Mon Sep 17 00:00:00 2001 From: andor <16273755+Andor233@users.noreply.github.com> Date: Wed, 22 May 2024 16:08:52 +0800 Subject: [PATCH 1/3] Fix #4507 --- stl/inc/ranges | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stl/inc/ranges b/stl/inc/ranges index ec72cc0c8aa..3390231f3fc 100644 --- a/stl/inc/ranges +++ b/stl/inc/ranges @@ -1708,8 +1708,8 @@ namespace ranges { } }; - template - repeat_view(_Ty, _Bo) -> repeat_view<_Ty, _Bo>; + template + repeat_view(_Ty, _Bo = _Bo()) -> repeat_view<_Ty, _Bo>; namespace views { struct _Repeat_fn { From c4f9bc35b738a243e86ebe2b000e8a1d1019b03a Mon Sep 17 00:00:00 2001 From: andor <16273755+Andor233@users.noreply.github.com> Date: Wed, 22 May 2024 16:48:01 +0800 Subject: [PATCH 2/3] Add test for #4507 --- tests/std/tests/P2474R2_views_repeat/test.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/std/tests/P2474R2_views_repeat/test.cpp b/tests/std/tests/P2474R2_views_repeat/test.cpp index c559b170407..e2ccce79cc6 100644 --- a/tests/std/tests/P2474R2_views_repeat/test.cpp +++ b/tests/std/tests/P2474R2_views_repeat/test.cpp @@ -360,6 +360,16 @@ constexpr bool test() { test_iterator_arithmetic(); test_iterator_arithmetic<_Signed128>(); + // GH-4507: LWG-4053 Unary call to std::views::repeat does not decay the argument + { + using RPV = std::ranges::repeat_view; + + static_assert(std::same_as); + static_assert(std::same_as); + static_assert(std::same_as); + static_assert(std::same_as); + } + return true; } From 836800ba3ce3c0a2884b1138c691676d585e8cb7 Mon Sep 17 00:00:00 2001 From: andor <16273755+Andor233@users.noreply.github.com> Date: Thu, 23 May 2024 02:16:42 +0800 Subject: [PATCH 3/3] Remove `std::` because there is already `using namespace std;` --- tests/std/tests/P2474R2_views_repeat/test.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/std/tests/P2474R2_views_repeat/test.cpp b/tests/std/tests/P2474R2_views_repeat/test.cpp index e2ccce79cc6..5723478a1c4 100644 --- a/tests/std/tests/P2474R2_views_repeat/test.cpp +++ b/tests/std/tests/P2474R2_views_repeat/test.cpp @@ -362,12 +362,12 @@ constexpr bool test() { // GH-4507: LWG-4053 Unary call to std::views::repeat does not decay the argument { - using RPV = std::ranges::repeat_view; + using RPV = ranges::repeat_view; - static_assert(std::same_as); - static_assert(std::same_as); - static_assert(std::same_as); - static_assert(std::same_as); + static_assert(same_as); + static_assert(same_as); + static_assert(same_as); + static_assert(same_as); } return true;