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.

Reply via email to