Bug 8201 – Conversion from dynamic array to static array fails when static array is immutable
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-06-05T23:38:00Z
Last change time
2012-09-14T19:09:47Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
issues.dlang
Comments
Comment #0 by issues.dlang — 2012-06-05T23:38:34Z
void main()
{
ubyte[] buffer = [0, 1, 2, 3, 4, 5];
ubyte[4] arr = buffer[0 .. 4]; //Compiles
const ubyte[4] cArr = buffer[0 .. 4]; //Compiles
immutable ubyte[4] iArr = buffer[0 .. 4]; //Fails to compile
}
I see no reason that the line with the immutable static array should fail to compile when the mutable and const ones succeed.
Comment #1 by k.hara.pg — 2012-09-09T05:03:53Z
*** Issue 4454 has been marked as a duplicate of this issue. ***
Comment #2 by k.hara.pg — 2012-09-09T05:05:38Z
Reduced test case:
void main()
{
uint[2] msa;
immutable uint[2] isa = msa;
}
This is a problem only in variable initializing.