www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14046] New: Overlapping dynamic array copy is allowed if

https://issues.dlang.org/show_bug.cgi?id=14046

          Issue ID: 14046
           Summary: Overlapping dynamic array copy is allowed if struct
                    contains postblit
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: verylonglogin.reg gmail.com

Overlapping dynamic array copy is now correctly disallowed in CTFE too (Issue
11467) but in runtime this one remaining case is allowed.

This code should throw `object.Error` in runtime but doesn't:
---
struct S { this(this) { } }

void main()
{
    S[1] a;
    a[0 .. 1] = a[0 .. 1];
}
---

--
Jan 26 2015