[Issue 5705] Swapping identical struct with hasElaborateAssign causes "overlapping array copy" exception.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Apr 18 12:45:08 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5705


kennytm at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Swapping identical tuple    |Swapping identical struct
                   |causes "overlapping array   |with hasElaborateAssign
                   |copy" exception.            |causes "overlapping array
                   |                            |copy" exception.


--- Comment #3 from kennytm at gmail.com 2011-04-18 12:41:34 PDT ---
The the reason is Tuple has an opAssign. The same reason goes for SysTime
(issue 5853). Generalized test case:

-------------------------------
import std.algorithm : swap;

struct X {
    int x;
    void opAssign(X z) {
        x = z.x;
    }
}

void main() {
    X y;
    swap(y, y);
}
-------------------------------

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list