digitalmars.D.bugs - [Issue 18523] New: In the language spec, clarify member function vs
- d-bugmail puremagic.com (34/34) Feb 25 2018 https://issues.dlang.org/show_bug.cgi?id=18523
https://issues.dlang.org/show_bug.cgi?id=18523 Issue ID: 18523 Summary: In the language spec, clarify member function vs UFCS lookup semantics Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW Severity: enhancement Priority: P1 Component: dlang.org Assignee: nobody puremagic.com Reporter: johnnymarler gmail.com I was unable to find in the spec what the rule is on function lookup in the case where you have both a member function and a UFCS function with the same name, but the arguments in the call match the UFCS function but not the member function, i.e. struct Foo { void bar(int x) { } } void bar(ref Foo foo, string x) { } void main() { Foo foo; foo.bar("hello"); } Compiling this results in: Error: function Foo.bar (int x) is not callable using argument types (string) It appears that a member function matching will always have priority over a UFCS function even if the arguments don't match the member function. This should be clarified in the spec. --
Feb 25 2018