https://issues.dlang.org/show_bug.cgi?id=21800
Paul Backus <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] Summary|Unused delegate template |Unused lambda causes |parameter scope incorrectly |unnecessary closure |inferred |allocation --- Comment #1 from Paul Backus <[email protected]> --- Simplified example: --- void main() @nogc { int x; void ignore() { alias F = () => x; } } --- Interestingly, replacing the lambda with a named function gets rid of the closure allocation: --- void main() @nogc { int x; void ignore() { auto F() { return x; } } } --- The above workaround also works for the original example. --
