https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101587

--- Comment #16 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Jonathan Wakely
<r...@gcc.gnu.org>:

https://gcc.gnu.org/g:09584eb968ef4751a704ee6a79ac1f31fd7beec8

commit r13-9499-g09584eb968ef4751a704ee6a79ac1f31fd7beec8
Author: Jonathan Wakely <jwak...@redhat.com>
Date:   Wed Mar 26 11:47:05 2025 +0000

    libstdc++: Replace use of __mindist in ranges::uninitialized_xxx algos
[PR101587]

    In r15-8980-gf4b6acfc36fb1f I introduced a new function object for
    finding the smaller of two distances. In bugzilla Hewill Kang pointed
    out that we still need to explicitly convert the result back to the
    right difference type, because the result might be an integer-like class
    type that doesn't convert to an integral type explicitly.

    Rather than doing that conversion in the __mindist function object, I
    think it's simpler to remove it again and just do a comparison and
    assignment. We always want the result to have a specific type, so we can
    just check if the value of the other type is smaller, and then convert
    that to the other type if so.

    libstdc++-v3/ChangeLog:

            PR libstdc++/101587
            * include/bits/ranges_uninitialized.h (__detail::__mindist):
            Remove.
            (ranges::uninitialized_copy, ranges::uninitialized_copy_n)
            (ranges::uninitialized_move, ranges::uninitialized_move_n): Use
            comparison and assignment instead of __mindist.
            *
testsuite/20_util/specialized_algorithms/uninitialized_copy/constrained.cc:
            Check with ranges that use integer-like class type for
            difference type.
            *
testsuite/20_util/specialized_algorithms/uninitialized_move/constrained.cc:
            Likewise.

    Reviewed-by: Tomasz Kaminski <tkami...@redhat.com>
    Reviewed-by: Hewill Kang <hewi...@gmail.com>
    (cherry picked from commit 03ac8886e5c1fa16da90276fd721a57fa9435f4f)

Reply via email to