[Issue 8101] Display candidate function overloads when function call fails

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu May 1 19:53:16 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=8101

--- Comment #3 from bearophile_hugs at eml.cc ---
The example code:


int foo(int);
int foo(int, int);
void main() {
    foo();
}


Now gives:

temp.d(4,8): Error: function temp.foo (int) is not callable using argument
types (), candidates are:
temp.d(1,5):        temp.foo(int)
temp.d(2,5):        temp.foo(int, int)


What's the point of writing "function temp.foo (int)"? If there are overloads
and none of them is fitting for the given arguments in the call, then I think
it's not useful to show one of the overloads there. So I think a better error
message is:


temp.d(4,8): Error: overloaded function temp.foo is not callable using argument
types (), candidates are:
temp.d(1,5):        temp.foo(int)
temp.d(2,5):        temp.foo(int, int)


But the current situation is acceptable, and it's much better than before, so
this doesn't matter much.

--


More information about the Digitalmars-d-bugs mailing list