[Issue 12506] New: Wrongly private lambda to define global immutable array

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Apr 2 04:33:16 PDT 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12506

           Summary: Wrongly private lambda to define global immutable
                    array
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2014-04-02 04:33:14 PDT ---
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))

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list