August 11, 2019
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: nobody@puremagic.com
          Reporter: simen.kjaras@gmail.com

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) {}
}

--