www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16099] New: Inconsistent rules for overloading lambdas

https://issues.dlang.org/show_bug.cgi?id=16099

          Issue ID: 16099
           Summary: Inconsistent rules for overloading lambdas
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: maxsamukha gmail.com

The compiler neither issues a duplicate declaration error, nor creates a proper
overload set:

alias f = (bool x) {};
alias f = (int y) {};

void main() {
    f(true); // ok
    f(1); // Error: function literal __lambda5 (bool x) is not callable using
argument types (int)
}

Creating proper overload sets would be a preferred fix.

--
May 30 2016