[Issue 17645] `pure` is transitively applied to all delegates inside a pure function

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Jul 13 05:24:56 PDT 2017


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

Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy at yahoo.com

--- Comment #1 from Steven Schveighoffer <schveiguy at yahoo.com> ---
Do you have a better use case? This works:

void f() pure {
    void function() dg = {x++;};
}

i.e. you don't need access to the pure function's stack frame, so you can have
a function instead of a delegate.

I'm kind of surprised the compiler inferred dg as a delegate and not a function
in the first place.

--


More information about the Digitalmars-d-bugs mailing list