[Issue 4665] New: map with no automatic closure

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Aug 17 07:22:28 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4665

           Summary: map with no automatic closure
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          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 2010-08-17 07:22:23 PDT ---
This D2 program seems correct:


import std.algorithm: map;
void main() {
    int n = 2;
    map!((double x){ return x * n; })([1.0, 2.0]);
}


But DMD 2.048 prints at run time:
object.Error: Access Violation


On IRC #D jA_cOp has commented that TDPL says that the compiler should
automatically choose delegate over function if it accesses its outer lexical
scope.

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


More information about the Digitalmars-d-bugs mailing list