[Bug libstdc++/98392] New: Parallel algorithms fail to enforce Mandates: requirements
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Dec 19 13:49:14 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98392
Bug ID: 98392
Summary: Parallel algorithms fail to enforce Mandates:
requirements
Product: gcc
Version: 10.2.1
Status: UNCONFIRMED
Keywords: accepts-invalid
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
Target Milestone: ---
For example:
Mandates: All of
— binary_op(init, init),
— binary_op(init, unary_op(*first)),
— binary_op(unary_op(*first), init), and
— binary_op(unary_op(*first), unary_op(*first))
are convertible to T.
This was stated with "Requires:" in C++17, but in C++20 violating the
requirement must be diagnosed.
Example:
#include <numeric>
#include <execution>
int main() {
int a[]{ 1 };
auto r = std::transform_reduce(
std::execution::seq, a, a+1, 0,
[](int& a, int b) {
return a + b;
},
[](int i) { return i; });
}
This compiles without error.
More information about the Gcc-bugs
mailing list