Bug 5630 – array() of iterable of immutable items

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2011-02-20T15:01:00Z
Last change time
2013-06-20T03:08:24Z
Keywords
rejects-valid
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2011-02-20T15:01:52Z
A D2 program: import std.algorithm: map; import std.array: array; void main() { auto r = map!q{ "A"[0] }([0, 1, 2]); auto a = array(r); // Error: result[i] isn't mutable assert(a == "AAA"); } DMD 2.052 gives the errors: ...\dmd\src\phobos\std\array.d(62): Error: result[i] isn't mutable test.d(5): Error: template instance std.array.array!(Map!(result,int[])) error instantiating In my opinion array() needs to be able to build an array of immutable items too, like a string from its immutable chars.
Comment #1 by irritate — 2013-06-19T19:20:02Z
Issue does not occur for me on head revision, DMD v2.064.
Comment #2 by bearophile_hugs — 2013-06-20T03:08:24Z
(In reply to comment #1) > Issue does not occur for me on head revision, DMD v2.064. OK, closed, despite I don't know if the test suite has a test case like that.