[llvm-bugs] [Bug 42323] New: numeric algos copy 'init' but it only has to be move constructible, not copyable

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jun 19 06:17:03 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=42323

            Bug ID: 42323
           Summary: numeric algos copy 'init' but it only has to be move
                    constructible, not copyable
           Product: parallel STL
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: New
          Assignee: ldionne at apple.com
          Reporter: zilla at kayari.org
                CC: llvm-bugs at lists.llvm.org

The "generalized numeric operations" defined in [numeric.ops] only require
Cpp17MoveConstructible for the T parameter, but PSTL copies it when passing it
from e.g. reduce to transform_reduce and then to __pattern_transform_reduce,
and then to __brick_transform_reduce and __brick_transform_scan.

Testcase:

#include <numeric>
#include <execution>

struct M {
  M(int) { }
  M(M&&) = default;
  M& operator=(M&&) = default;
};

struct Bop
{
  M operator()(M&, M&) { return M(0); }
};

int main()
{
  M m(0);
  std::reduce(std::execution::par, &m, &m, M{0}, Bop{});
}

The same problem exists for the other <numeric> algos too.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190619/133018fc/attachment.html>


More information about the llvm-bugs mailing list