Bug 18913 – Cannot move static array of non-copyable type
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
Windows
Creation time
2018-05-30T01:37:49Z
Last change time
2021-01-21T10:41:27Z
Assigned to
Eduard Staniloiu
Creator
Bolpat
Comments
Comment #0 by qs.il.paperinik — 2018-05-30T01:37:49Z
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.