https://issues.dlang.org/show_bug.cgi?id=16610
Issue ID: 16610 Summary: Error: function fun (Bar bar) is not callable using argument types (Bar) Product: D Version: D2 Hardware: x86 OS: All Status: NEW Severity: major Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: timothee.co...@gmail.com dmd can produce uncomprehensible error messages such as: Error: function fun (Bar bar) is not callable using argument types (Bar) Or variants of this: ``` Error: template std.typecons.Nullable!(Bar).Nullable.opAssign cannot deduce function from argument types !()(Bar) ``` (from https://github.com/msoucy/dproto/issues/99) The problem is that `Bar` and `Bar`, although referring to 2 different types, have the same name. This can occur when defined inside a template, eg: ``` template baz(string Tname, string file_protodef){ enum protodef=import(file_protodef); import dproto.dproto; mixin ProtocolBufferFromString!protodef; mixin("alias baz="~Tname~";"); } ``` The fix would be to fully qualify the name `Bar` when possible, or prefix it with a compiler generated string representing context as done for lambdas, eg: `__context142.Bar` vs `__context143.Bar` --