Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #4507: LWG-4053 Unary call to std::views::repeat does not decay the argument #4685

Merged
merged 3 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions stl/inc/ranges
Original file line number Diff line number Diff line change
Expand Up @@ -1708,8 +1708,8 @@ namespace ranges {
}
};

template <class _Ty, class _Bo>
repeat_view(_Ty, _Bo) -> repeat_view<_Ty, _Bo>;
template <class _Ty, class _Bo = unreachable_sentinel_t>
repeat_view(_Ty, _Bo = _Bo()) -> repeat_view<_Ty, _Bo>;

namespace views {
struct _Repeat_fn {
Expand Down
10 changes: 10 additions & 0 deletions tests/std/tests/P2474R2_views_repeat/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,16 @@ constexpr bool test() {
test_iterator_arithmetic<wchar_t>();
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<const char*>;

static_assert(std::same_as<decltype(std::views::repeat("foo", std::unreachable_sentinel)), RPV>);
static_assert(std::same_as<decltype(std::views::repeat(+"foo", std::unreachable_sentinel)), RPV>);
static_assert(std::same_as<decltype(std::views::repeat("foo")), RPV>);
static_assert(std::same_as<decltype(std::views::repeat(+"foo")), RPV>);
Andor233 marked this conversation as resolved.
Show resolved Hide resolved
}

return true;
}

Expand Down