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

           Summary: Assigning a static array to itself should be allowed
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: dsim...@yahoo.com


--- Comment #0 from David Simcha <dsim...@yahoo.com> 2010-09-02 21:48:58 PDT ---
void main() {
    int[2] foo;
    foo = foo;
}

object.Exception: overlapping array copy

This is a ridiculous limitation and is bugs waiting to happen.  (For example,
Bug 4789.)  Even if this requires a simple runtime check before calling
memcpy() or whatever, IMHO it's worth it because the cost of a single pointer
comparison is negligible in almost all cases and for tiny static arrays (where
it might not be negligible) the compiler could just generate regular assignment
instructions that are safe for the overlapping/identical case instead of using
something like memcpy().

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

Reply via email to