[Bug libstdc++/95833] Incorrect static_assert in std::reduce overload taking a binary functor

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jun 18 14:06:30 GMT 2021


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

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

https://gcc.gnu.org/g:0532452dcd17910dfd3d2b0df50dfe3ef1194bf7

commit r12-1645-g0532452dcd17910dfd3d2b0df50dfe3ef1194bf7
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Jun 18 14:46:58 2021 +0100

    libstdc++: Replace incorrect static assertion in std::reduce [PR95833]

    The standard does not require the iterator's value type to be
    convertible to the result type, it only requires that the result of
    dereferencing the iterator can be passed to the binary function.

    libstdc++-v3/ChangeLog:

            PR libstdc++/95833
            * include/std/numeric (reduce(Iter, Iter, T, BinaryOp)): Replace
            incorrect static_assert with ones matching the 'Mandates'
            conditions in the standard.
            * testsuite/26_numerics/reduce/95833.cc: New test.


More information about the Gcc-bugs mailing list