diff --git a/stl/inc/ranges b/stl/inc/ranges index 6d20dc78589..a504f4cfe8d 100644 --- a/stl/inc/ranges +++ b/stl/inc/ranges @@ -5380,7 +5380,8 @@ namespace ranges { _NODISCARD constexpr auto size() const noexcept(noexcept(_RANGES end(_Parent->_Range) - *_Parent->_Current)) /* strengthened */ requires sized_sentinel_for, iterator_t<_Vw>> { - return (_STD min)(_Parent->_Remainder, _RANGES end(_Parent->_Range) - *_Parent->_Current); + return _To_unsigned_like( + (_STD min)(_Parent->_Remainder, _RANGES end(_Parent->_Range) - *_Parent->_Current)); } }; diff --git a/tests/std/tests/P2442R1_views_chunk/test.cpp b/tests/std/tests/P2442R1_views_chunk/test.cpp index f2f14cb4ea0..95b9b86d23e 100644 --- a/tests/std/tests/P2442R1_views_chunk/test.cpp +++ b/tests/std/tests/P2442R1_views_chunk/test.cpp @@ -465,7 +465,8 @@ constexpr bool test_input(Rng&& rng, Expected&& expected) { auto val_ty = *outer_iter; if constexpr (sized_sentinel_for, iterator_t>) { - assert(val_ty.size() == 2); + const same_as<_Make_unsigned_like_t>> auto s = val_ty.size(); // test LWG-3707 + assert(s == 2); } auto inner_iter = val_ty.begin();