[llvm-bugs] [Bug 36850] New: std::copy_n requires non-overlapping inputs

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 21 06:44:36 PDT 2018


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

            Bug ID: 36850
           Summary: std::copy_n requires non-overlapping inputs
           Product: libc++
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: t.p.northover at gmail.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

Created attachment 20096
  --> https://bugs.llvm.org/attachment.cgi?id=20096&action=edit
Example of unexpected behaviour

Most of the "std::copy*" functions explicitly require their input and output
iterators not to overlap, but std::copy_n doesn't seem to.

However, the implementation of std::copy_n in libc++ forwards to a version of
std::copy which behaves differently than expected from a straightforward
reading of copy_n's effects clause and calls memmove.

This came up on IRC, where Eelis came up with the attached C++ file
demonstrating the difference from a naive copy_n.

-- 
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/20180321/634394d4/attachment.html>


More information about the llvm-bugs mailing list