August 10, 2021
https://issues.dlang.org/show_bug.cgi?id=21800

Paul Backus <snarwin+bugzilla@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |snarwin+bugzilla@gmail.com
            Summary|Unused delegate template    |Unused lambda causes
                   |parameter scope incorrectly |unnecessary closure
                   |inferred                    |allocation

--- Comment #1 from Paul Backus <snarwin+bugzilla@gmail.com> ---
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.

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=21800

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P2

--