]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Replace incorrect static assertion in std::reduce [PR95833]
authorJonathan Wakely <jwakely@redhat.com>
Fri, 18 Jun 2021 13:46:58 +0000 (14:46 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Fri, 18 Jun 2021 15:55:09 +0000 (16:55 +0100)
commitfe918041ce9809755a7e1b2f62071c2b27829610
treec6b0d6cb6a6eabdb459d9b4c7019360eaa093881
parent85f85b7e62aacc6abae475932cf483a4c80176ce
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.

(cherry picked from commit 0532452dcd17910dfd3d2b0df50dfe3ef1194bf7)
libstdc++-v3/include/std/numeric
libstdc++-v3/testsuite/26_numerics/reduce/95833.cc [new file with mode: 0644]