[Issue 16042] New: Identifier on template arguments should consider eponymous member lookup
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed May 18 04:51:55 PDT 2016
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 at puremagic.com
Reporter: k.hara.pg at gmail.com
>From 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].
--
More information about the Digitalmars-d-bugs
mailing list