www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7057] New: Compiler errors on different functions on argument mismatch

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: andrej.mitrovich gmail.com



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: -------
Dec 02 2011
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7057


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |LATER



14:44:27 PDT ---
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.

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