[Issue 20121] New: "template lambda has no value" when assigned to struct
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Aug 11 18:51:06 UTC 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 at puremagic.com
Reporter: simen.kjaras at 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) {}
}
--
More information about the Digitalmars-d-bugs
mailing list