[llvm-bugs] [Bug 28527] New: std::copy() calls memmove on nontrivially-copyable type
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jul 12 14:49:29 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=28527
Bug ID: 28527
Summary: std::copy() calls memmove on nontrivially-copyable
type
Product: libc++
Version: 3.8
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: aaron at aaronballman.com
CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
Classification: Unclassified
Consider the following snippet:
#include <algorithm>
int main() {
volatile int *v1[100];
volatile int *v2[100];
std::copy(v1, v1 + 100, v2);
}
This results in a call to memmove() rather than copying individual volatile
elements of the array (https://godbolt.org/g/b0fv3R). This should be handled a
bit more kindly, since volatile-qualified types are not trivially-copyable
types ([basic.types]p9 states in part: "Cv-unqualified scalar types, trivially
copyable class types (Clause 9), arrays of such types, and nonvolatile
const-qualified versions of these types (3.9.3) are collectively called
trivially copyable types.").
--
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/20160712/0b3a6710/attachment-0001.html>
More information about the llvm-bugs
mailing list