Comment #0 by bearophile_hugs — 2014-05-02T23:22:46Z
void bar(float) {}
void bar(double) {}
void bar(real) {}
void main() {
bar(1);
}
Gives in dmd 2.066alpha:
temp.d(5,8): Error: temp.bar called with argument types (int) matches both:
temp.d(1,6): temp.bar(float _param_0)
and:
temp.d(3,6): temp.bar(real _param_0)
I suggest to list all overloads and remove the word "both". I suggest to use a visual output similar to the one generated fixing Issue 8101 , that gives errors that look like this:
temp.d(7,5): Error: None of the overloads of 'foo' are callable using argument types (), candidates are:
temp.d(1,6): temp.foo(int _param_0)
temp.d(2,6): temp.foo(int _param_0, int _param_1)
So I suggest an error message like:
temp.d(5,8): Error: call to 'bar' with argument types (int) matches more than one overload, candidates are:
temp.d(1,6): test.bar(float _param_0)
temp.d(2,6): test.bar(double _param_0)
temp.d(3,6): test.bar(real _param_0)
I think it's useful to improve such error messages because calling functions is one of the most basic and common operations you do in D.
See also Issue 2789 .
Comment #1 by robert.schadek — 2024-12-13T18:20:22Z