D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 18913 - Cannot move static array of non-copyable type
Summary: Cannot move static array of non-copyable type
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All Windows
: P1 major
Assignee: Eduard Staniloiu
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-30 01:37 UTC by Bolpat
Modified: 2021-01-21 10:41 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Bolpat 2018-05-30 01:37:49 UTC
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 Eduard Staniloiu 2018-12-18 14:15:27 UTC
PR - https://github.com/dlang/phobos/pull/6810
Comment 2 github-bugzilla 2018-12-23 19:55:33 UTC
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 <ZombineDev@users.noreply.github.com>