Bug 9187 – -inline doesn't work with nested lambda functions

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2012-12-19T09:02:00Z
Last change time
2013-06-10T05:40:53Z
Assigned to
nobody
Creator
egustc

Comments

Comment #0 by egustc — 2012-12-19T09:02:49Z
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
Comment #1 by verylonglogin.reg — 2013-06-10T05:40:53Z
Same test (but obfuscated a bit) as in Issue 4841 description. *** This issue has been marked as a duplicate of issue 4841 ***