Bug 15913 – cannot initialize immutable fixed size array without similar const-code
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-04-12T06:35:00Z
Last change time
2016-10-01T11:46:22Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
r.sagitario
Comments
Comment #0 by r.sagitario — 2016-04-12T06:35:24Z
This is an extraction from the dmd testsuite that is failing with LDC in the merge-2.071 branch. dmd behaves strangely, too:
void test10282()
{
//const int[3] a4 = [1, 3, 6] * 3;
immutable int[3] a5 = [1, 3, 6] * 3;
}
yields:
Error: invalid array operation 'a5[] = [1, 3, 6] * 3' for element type immutable(int)
while adding the commented line makes it compile.