Bug 12506 – Wrongly private lambda to define global immutable array

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-04-02T04:33:00Z
Last change time
2014-04-10T01:54:06Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2014-04-02T04:33:14Z
A problem found by ketmar: import std.range: iota; import std.algorithm: map; import std.array: array; private bool[9] a = 9.iota.map!(i => true).array; // OK private immutable bool[9] b = 9.iota.map!(i => true).array; // error void main() {} DMD 2.066alpha gives: ...\dmd2\src\phobos\std\algorithm.d(512,19): Error: function test.__lambda8 is not accessible from module algorithm ...\dmd2\src\phobos\std\array.d(29,5): Error: template instance std.traits.isIterable!(MapResult!(__lambda8, Result)) error instantiating test.d(5,53): instantiated from here: array!(MapResult!(__lambda8, Result))
Comment #1 by k.hara.pg — 2014-04-03T00:21:59Z
Comment #2 by github-bugzilla — 2014-04-10T01:53:48Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/4a60c72016b003f173070ce718f5e272f4226fd6 fix Issue 12506 - Wrongly private lambda to define global immutable array https://github.com/D-Programming-Language/dmd/commit/361b953ece107041514caecdde204660a60cb483 Merge pull request #3419 from 9rnsr/fix12506 Issue 12506 - Wrongly private lambda to define global immutable array