Bug 11467 – [CTFE] Overlapping array copy is allowed in CT
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-11-07T07:37:00Z
Last change time
2015-01-26T04:51:45Z
Keywords
accepts-invalid, CTFE, pull
Assigned to
nobody
Creator
verylonglogin.reg
Comments
Comment #0 by verylonglogin.reg — 2013-11-07T07:37:54Z
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.