[libcxx-commits] [libcxx] [libc++] avoid using `ranges::advance` and `ranges::next` in all algorithms (PR #179095)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Tue Feb 3 02:29:11 PST 2026


philnik777 wrote:

> > I don't think this is the correct path. Are we seriously saying that we can't use `ranges::advance` inside `ranges::` algorithms? Given that all implementations seem to agree this should be rejected, I don't see the problem. The only issue I see is using `ranges::` algorithms inside non-ranges code, which we already knew was problematic, which is why we have the `_AlgPolicy` garbage.
> 
> > Given that all implementations seem to agree this should be rejected
> 
> I think gcc/libstdc++ is happily accepting it. I guess libstdc++ does not use `ranges::advance` or `ranges::next` in their algorithms? https://godbolt.org/z/T1qoafej9

libstc++ happens to not use it in this particular case one. There are other algorithms where it uses it, and it's rejected the same way as MSVC and libc++ do: https://godbolt.org/z/bs6vfdrhj


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


More information about the libcxx-commits mailing list