[Issue 18913] New: Cannot move static array of non-copyable type
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed May 30 01:37:49 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18913
Issue ID: 18913
Summary: Cannot move static array of non-copyable type
Product: D
Version: D2
Hardware: All
OS: Windows
Status: NEW
Severity: major
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: qs.il.paperinik at gmail.com
This code fails
struct NoCopy
{
int payload; // some payload
~this() { } // destructor to observe moving
@disable:
this(this); // make it non copyable
}
void f(NoCopy[2]) { }
void main()
{
import std.algorithm.mutation : move;
NoCopy[2] ncarray = [ NoCopy(1), NoCopy(2) ];
static assert(!__traits(compiles,
f(ncarray) // would copy
));
f(move(ncarray)); // fails
}
move wants to copy content.
This is not a dup of 8067.
--
More information about the Digitalmars-d-bugs
mailing list