digitalmars.D.bugs - [Issue 16042] New: Identifier on template arguments should consider
- via Digitalmars-d-bugs (41/42) May 18 2016 https://issues.dlang.org/show_bug.cgi?id=16042
https://issues.dlang.org/show_bug.cgi?id=16042 Issue ID: 16042 Summary: Identifier on template arguments should consider eponymous member lookup Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: rejects-valid Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: k.hara.pg gmail.comFrom a forum post:http://forum.dlang.org/thread/dhbqxlldujowejxntwyy forum.dlang.org Sadly dmd has multiple analysis pass for equivalent code. The reduced case is: struct Foo {} void map(alias func, T)(T t) { func(t); } auto toChars(R)(R r) if (is(R == int[])) { Foo f; toChars(f); // OK [1] //map!(toChars)(f); // NG [2] map!((toChars))(f); // OK [3] } auto toChars(Foo f) { } void main() { [1].toChars(); } In [3], '(toChars)' is parsed as an expression, then it will get same semantic analysis pass with [1]. But in [2], 'toChars' is parsed as a type, and its analysis is different from [2] or [3]. --
May 18 2016