[Issue 7057] New: Compiler errors on different functions on argument mismatch

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Dec 2 17:48:53 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=7057

           Summary: Compiler errors on different functions on argument
                    mismatch
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2011-12-02 17:47:47 PST ---
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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list