Bug 7057 – Compiler errors on different functions on argument mismatch
Status
RESOLVED
Resolution
LATER
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-12-02T17:47:00Z
Last change time
2013-09-17T14:44:27Z
Assigned to
nobody
Creator
andrej.mitrovich
Comments
Comment #0 by andrej.mitrovich — 2011-12-02T17:47:47Z
struct Foo
{
void test(int) { }
void test(int, int, string, string, int) { }
}
void main()
{
Foo foo;
foo.test(0, 0, "", "");
}
test.d(10): Error: function test.Foo.test (int _param_0) is not callable using argument types (int,int,string,string)
test.d(10): Error: expected 5 function arguments, not 4
This is extremely confusing in a library that has multiple function overloads. The compiler first prints out the first function, but then prints out the argument count of the second function which was the best match. It should *not* talk about the first function at all if the second is more likely a match. The error message should be:
test.d(10): Error: function test.Foo.test (int _param_0,int _param_1,string _param_2,string _param_3) is not callable using argument types (int,int,string,string)
test.d(10): Error: expected 5 function arguments, not 4
Comment #1 by andrej.mitrovich — 2013-09-17T14:44:27Z
Walter pulled out the additional diagnostics (which kinda solves this issue), but I hope we can pull them back in again at a later point and then also fix them.
I'm marking this for later.