Issue 90884
Summary `<numeric>`: `std::reduce` is missing `static_assert` for _Mandates_
Labels new issue
Assignees
Reporter hewillk
    ```cpp
#include <vector>
#include <string>
#include <numeric>
#include <execution>

struct Op {
 int operator()(int, std::string);
};

int main() {
 std::vector<std::string> v;
  return std::reduce(v.begin(), v.end(), 0, Op{});
}
```

https://godbolt.org/z/5T4cn95nv

According to the current wording, the above should be rejected as `std::reduce` has the following _Mandates_ ([[reduce]](https://eel.is/c++draft/reduce#5)): 

> _Mandates_: All of
> (5.1) - `binary_op(init, *first)`,
> (5.2) - `binary_op(*first, init)`,
> (5.3) - `binary_op(init, init)`, and
> (5.4) - `binary_op(*first, *first)`
> are convertible to `T`.
> 

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to