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

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 9187 - -inline doesn't work with nested lambda functions
Summary: -inline doesn't work with nested lambda functions
Status: RESOLVED DUPLICATE of issue 4841
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
Reported: 2012年12月19日 09:02 UTC by egustc
Modified: 2013年06月10日 05:40 UTC (History)
1 user (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description egustc 2012年12月19日 09:02:49 UTC
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 Denis Shelomovskii 2013年06月10日 05:40:53 UTC
Same test (but obfuscated a bit) as in Issue 4841 description.
*** This issue has been marked as a duplicate of issue 4841 ***


AltStyle によって変換されたページ (->オリジナル) /