D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 8067 - std.algorithm.move doesn't work for static array of elaborate struct
Summary: std.algorithm.move doesn't work for static array of elaborate struct
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: bootcamp
: 12224 (view as issue list)
Depends on:
Blocks:
 
Reported: 2012-05-08 10:20 UTC by Kenji Hara
Modified: 2022-08-31 09:23 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Kenji Hara 2012-05-08 10:20:38 UTC
This code doesn't work.

import std.algorithm, std.traits;
void main()
{
    static int postblit, dtor;

    static struct S2
    {
        this(this){ ++postblit; }
        ~this(){ ++dtor; }
    }
    S2[3] sa21;
    postblit = dtor = 0;
    S2[3] sa22 = move(sa21);
    assert(postblit == 0);  // fails
}
Comment 1 Denis Shelomovskii 2012-11-03 12:50:28 UTC
Fixed with all other `move` issues in [provoking]
https://github.com/D-Programming-Language/phobos/pull/923
Comment 2 Simon 2014-02-22 08:02:54 UTC
*** Issue 12224 has been marked as a duplicate of this issue. ***
Comment 3 RazvanN 2022-08-31 09:23:17 UTC
This code successfully compiles and runs. closing as fixed.