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

          Issue ID: 20121
           Summary: "template lambda has no value" when assigned to struct
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: [email protected]
          Reporter: [email protected]

Lambdas don't correctly decay to functions or delegates when assigned via
opAssign, but do so correctly for regular functions and member functions, even
calling opAssign directly, and with property syntax:

unittest {
    S s;
    s.opAssign(i => i + 1); // Works
    s.opAssign = i => i + 1; // Works
    s = i => i + 1; // Fails (template lambda has no value)
}

struct S {
    void opAssign(int delegate(int) fn) {}
    void opAssign(int function(int) fn) {}
}

--

Reply via email to