www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10602] New: Better error message for wrong template lambda given to function

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 puremagic.com
        ReportedBy: bearophile_hugs eml.cc



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: -------
Jul 10 2013