[libcxx-commits] [libcxx] [libc++][ranges] Mark LWG3664 as resolved (PR #210550)
A. Jiang via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Jul 19 16:52:35 PDT 2026
================
@@ -86,11 +86,11 @@ struct __distance {
}
template <class _Ip, sized_sentinel_for<decay_t<_Ip>> _Sp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Ip> operator()(_Ip&& __first, _Sp __last) const {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<decay_t<_Ip>> operator()(_Ip&& __first, _Sp __last) const {
if constexpr (sized_sentinel_for<_Sp, __remove_cvref_t<_Ip>>) {
return __last - __first;
} else {
- return __last - decay_t<_Ip>(__first);
+ return __last - static_cast<decay_t<_Ip>>(__first);
----------------
frederick-vs-ja wrote:
As `decay_t<_Ip>` is an iterator type, `decay_t<_Ip>(__first)` is equivalent to `static_cast<decay_t<_Ip>>(__first)`, and we don't need to change this line. But it seems that we should change the return type of this `operator()`.
I think we should try to add a test case which fails without changing the return type.
https://github.com/llvm/llvm-project/pull/210550
More information about the libcxx-commits
mailing list