[Issue 14783] New: Overlapping Arrays with Binary Operations on Itself
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Jul 7 10:34:02 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14783
Issue ID: 14783
Summary: Overlapping Arrays with Binary Operations on Itself
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: john.michael.hall at gmail.com
The code below will not compile (on DMD 2.067.1) due to an overlapping array
error.
void main()
{
int[] x = [0, 1, 2];
x[] *= x[];
}
Neither will it compile with x[] += x[];.
Normally an overlapping error is when you try to do something like
x[1..$] *= x[0..$-1];
However, in this case, there is exact matching. The compiler should be able to
detect when it is a case like this and handle it appropriately.
Original discussion here:
http://forum.dlang.org/thread/xplooifwemzdtyigcnky@forum.dlang.org
--
More information about the Digitalmars-d-bugs
mailing list