Bug 16042 – Identifier on template arguments should consider eponymous member lookup
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-05-18T11:51:55Z
Last change time
2017-12-29T05:27:57Z
Keywords
pull, rejects-valid
Assigned to
No Owner
Creator
Kenji Hara
Comments
Comment #0 by k.hara.pg — 2016-05-18T11:51:55Z
From a forum post:
http://forum.dlang.org/thread/[email protected]
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].