Skip to content

Commit

Permalink
Fix #4507: LWG-4053 Unary call to std::views::repeat does not decay t…
Browse files Browse the repository at this point in the history
…he argument (#4685)
  • Loading branch information
Andor233 authored May 23, 2024
1 parent 37b793c commit ff0cff1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
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 = ranges::repeat_view<const char*>;

static_assert(same_as<decltype(views::repeat("foo", unreachable_sentinel)), RPV>);
static_assert(same_as<decltype(views::repeat(+"foo", unreachable_sentinel)), RPV>);
static_assert(same_as<decltype(views::repeat("foo")), RPV>);
static_assert(same_as<decltype(views::repeat(+"foo")), RPV>);
}

return true;
}

Expand Down

0 comments on commit ff0cff1

Please sign in to comment.