www.digitalmars.com         C & C++   DMDScript  

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

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: egustc gmail.com



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: -------
Dec 19 2012
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9187


Denis Shelomovskij <verylonglogin.reg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |verylonglogin.reg gmail.com
         Resolution|                            |DUPLICATE



16:40:53 MSD ---
Same test (but obfuscated a bit) as in Issue 4841 description.

*** This issue has been marked as a duplicate of issue 4841 ***

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