llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.81k stars 11.45k forks source link

Parallel algorithms fail to enforce Mandates: requirements #47901

Open 3a17e7c4-fca4-4827-b2a7-11a54d73d746 opened 3 years ago

3a17e7c4-fca4-4827-b2a7-11a54d73d746 commented 3 years ago
Bugzilla Link 48557
Version unspecified
OS Linux

Extended Description

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

include

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 using GCC's copy of the PSTL code.

3a17e7c4-fca4-4827-b2a7-11a54d73d746 commented 3 years ago

assigned to @ldionne