www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11467] New: [CTFE] Overlapping array copy is allowed in CT

https://d.puremagic.com/issues/show_bug.cgi?id=11467

           Summary: [CTFE] Overlapping array copy is allowed in CT
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: accepts-invalid, CTFE
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: verylonglogin.reg gmail.com


--- Comment #0 from Denis Shelomovskij <verylonglogin.reg gmail.com> 2013-11-07
18:37:54 MSK ---
Overlapping array copy is allowed (and works fine for now) during CTFE:
---
static assert({
    auto a = [0, 1, 2, 3, 4];
    a[0 .. 4] = a[1 .. 5];
    assert(a == [1, 2, 3, 4, 4]);

    a = [0, 1, 2, 3, 4];
    a[1 .. 5] = a[0 .. 4];
    assert(a == [0, 0, 1, 2, 3]);
    return 1;
}());
---

But it is inconsistent with runtime behaviour when exception is thrown in such
case. I'd say it should be disallowed in CTFE too.

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