[Issue 10602] New: Better error message for wrong template lambda given to function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jul 10 17:36:50 PDT 2013


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

           Summary: Better error message for wrong template lambda given
                    to function
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2013-07-10 17:36:48 PDT ---
This is wrong code:


void foo(int function(int) f) {}
void main() {
    foo(x => 0);      // OK
    foo(x => 0.0);    // Error
    foo((x, y) => 0); // Error
}


DMD 2.064alpha gives:

test.d(4): Error: function test.foo (int function(int) f) is not callable using
argument types (void)
test.d(5): Error: function test.foo (int function(int) f) is not callable using
argument types (void)


I suggest to try to generate better error messages here, that better explain
the problem to the programmer.

-- 
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