[Issue 18738] [scope] scope delegates can be escaped via closure

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Apr 21 13:05:48 UTC 2018


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

Nick Treleaven <nick at geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nick at geany.org

--- Comment #1 from Nick Treleaven <nick at geany.org> ---
Closures don't seem to be checked for scope pointers at all:

@safe:
void delegate() foo(ref int a) {
        return { a++; };
}

void delegate() bar() {
        int a;
        return foo(a); // leaking reference to `a`
}

--


More information about the Digitalmars-d-bugs mailing list