[libc++] Fix bug in ranges::advance
In `ranges::advance(iter, n, bound)`, we'd incorrectly handle the case where bound < iter and n is 0: int a[10]; int *p = a+5; int *bound = a+3; std::ranges::advance(p, 0, bound); assert(p - a == 5); // we'd return 3 before this patch This was caused by an incorrect handling of 0 inside __magnitude_geq. Differential Revision: https://reviews.llvm.org/D117240
Loading
Please sign in to comment