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.
Comment #3 by k.hara.pg — 2012-09-09T05:35:50Z
Comment #4 by github-bugzilla — 2012-09-14T06:22:13Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/da8e2a038105ad0149a8f66fbcfe31079ce3a534 fix Issue 8201 - Conversion from dynamic array to static array fails when static array is immutable https://github.com/D-Programming-Language/dmd/commit/ff32f4256e2863f63628f54f43187a8c83c4f8de Merge pull request #1109 from 9rnsr/fix8201 Issue 8201 - Conversion from dynamic array to static array fails when static array is immutable