[Issue 9187] New: -inline doesn't work with nested lambda functions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Dec 19 09:02:50 PST 2012


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

           Summary: -inline doesn't work with nested lambda functions
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: egustc at gmail.com


--- Comment #0 from egustc at gmail.com 2012-12-19 09:02:49 PST ---
As the code below shows, dmd doesn't compile well when a lambda function is
nested another lambda(only fails if the result is used somehow later).

test case:
===========
module foo;
import std.algorithm, std.range, std.array;

auto bar()
{
    auto data = [5, 6, 7, 8],
        test = map!( (x) => reduce!"a+b"(data[$-x..$]) )([1, 3]);
    return array(test); // or "wrilteln(test);". if just "return test;" it
works.
}
==========

When compile this module without -inline, it works. Otherwise it will be
failed:
foo.d(7): Error: function foo.bar is a nested function and cannot be accessed
from std.array.array!(MapResult!(__lambda2,int[])).array

-- 
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