4724 – Template literal escaping: Inconsistent behavior when -inline is on

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4724 - Template literal escaping: Inconsistent behavior when -inline is on
Summary: Template literal escaping: Inconsistent behavior when -inline is on
Status: RESOLVED DUPLICATE of issue 4841
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks: 7339
Show dependency tree / graph
Reported: 2010年08月25日 08:31 UTC by David Simcha
Modified: 2012年01月24日 13:41 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 David Simcha 2010年08月25日 08:31:42 UTC
Not sure if this is a rejects-valid or an accepts-invalid, since the spec isn't clear on how passing template alias parameters that refer to a function scope is supposed to work. The inconsistency, though, means at least one of these is wrong.
import std.algorithm, std.array;
void main() {
 uint[] arr = [1, 2, 3];
 // Doesn't work with -inline
 auto res1 = array(
 map!((a) { return a == arr[0]; })(arr)
 );
 // Works if the previous statement is commented out or -inline
 // is disabled.
 auto res2 = array(
 map!((uint a) { return a == arr[0]; })(arr)
 );
}
Error message (version 2.048, only when -inline is enabled):
test.d(8): Error: function D main is a nested function and cannot be accessed from array
Comment 1 bearophile_hugs 2011年09月22日 14:19:41 UTC
This is an important issue, I hit it often.
Comment 2 David Simcha 2012年01月24日 13:41:42 UTC
*** This issue has been marked as a duplicate of issue 4841 ***


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