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.
Comment #1 by edi33416 — 2018-12-18T14:15:27Z
Comment #2 by github-bugzilla — 2018-12-23T19:55:33Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/a3fdf76c092e7c4852986316598ec882ab0d46c1 Fix Issue 18913 - Cannot move static array of non-copyable type https://github.com/dlang/phobos/commit/e03499831700e60daf9d58ada076646f178618ab Merge pull request #6810 from edi33416/issue_18913 Fix Issue 18913 - Cannot move static array of non-copyable type merged-on-behalf-of: Petar Kirov <[email protected]>