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

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

https://gcc.gnu.org/g:df1d436d17c8280bd835b045bd7babf5058a7154

commit r16-426-gdf1d436d17c8280bd835b045bd7babf5058a7154
Author: Jonathan Wakely <jwak...@redhat.com>
Date:   Wed Dec 4 21:50:22 2024 +0000

    libstdc++: Fix <numeric> parallel algos for move-only values [PR117905]

    All of reduce, transform_reduce, exclusive_scan, and inclusive_scan,
    transform_exclusive_scan, and transform_inclusive_scan have a
    precondition that the type of init meets the Cpp17MoveConstructible
    requirements. It isn't required to be copy constructible, so when
    passing it to the next internal function it needs to be moved, not
    copied. We also need to move when creating local variables on the stack,
    and when returning as part of a pair.

    libstdc++-v3/ChangeLog:

            PR libstdc++/117905
            * include/pstl/glue_numeric_impl.h (reduce, transform_reduce)
            (transform_reduce, inclusive_scan, transform_exclusive_scan)
            (transform_inclusive_scan): Use std::move for __init parameter.
            * include/pstl/numeric_impl.h (__brick_transform_reduce)
            (__pattern_transform_reduce, __brick_transform_scan)
            (__pattern_transform_scan): Likewise.
            * include/std/numeric (inclusive_scan, transform_exclusive_scan):
            Use std::move to create local copy of the first element.
            * testsuite/26_numerics/pstl/numeric_ops/108236.cc: Move test
            using move-only type to ...
            * testsuite/26_numerics/pstl/numeric_ops/move_only.cc: New test.

Reply via email to