[libcxx-commits] [libcxx] [libc++][ranges] Resolve LWG4242 (PR #211568)

Lucas Mellone via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 24 02:18:04 PDT 2026


================
@@ -87,10 +87,10 @@ 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 {
-    if constexpr (sized_sentinel_for<_Sp, __remove_cvref_t<_Ip>>) {
+    if constexpr (!is_array_v<remove_reference_t<_Ip>>) {
----------------
lknknm wrote:

Yes, I think I've misstated myself there. I've changed the PR description with new wording. Let me know if you agree.
--
I have to mention I added the `static_cast` for the `else` condition there because I had some failures in CI but I think they were unrelated. If you prefer we can just remove it.

https://github.com/llvm/llvm-project/pull/211568


More information about the libcxx-commits mailing list