Bug 6079 – [CTFE] Array index out of bound detection is off-by-one
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Mac OS X
Creation time
2011-05-31T01:59:00Z
Last change time
2011-06-01T22:49:53Z
Keywords
accepts-invalid
Assigned to
nobody
Creator
kennytm
Comments
Comment #0 by kennytm — 2011-05-31T01:59:48Z
Test case:
------------------------
static assert({
int[] x = [1,2,3,4];
x[4] = 1;
return true;
}());
------------------------
In 2.052 this is correctly rejected, but in 2.053 this is wrongly accepted. Changing the [4] to [5] will make the code fail to compile. There should be some off-by-one error introduced between the two versions.