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

--- Comment #0 from David Simcha <> 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:
------- You are receiving this mail because: -------

Reply via email to