[Issue 21912] Invalid stack closure when calling delegate inside lambda

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon May 10 19:38:49 UTC 2021


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

moonlightsentinel at disroot.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |moonlightsentinel at disroot.o
                   |                            |rg

--- Comment #2 from moonlightsentinel at disroot.org ---
Slightly reduced:

@safe:

auto foo(DG)(DG dg, int p) {
    return () => dg(p);
}

auto bla(int i) {
    return foo((int p)=>i*p, 66);
}

void main() {
    assert(bla(5)() == 330);
}

=====================================

Only requires -dip1000 which probably hints at invalid scope inference.

--


More information about the Digitalmars-d-bugs mailing list