[Issue 16037] assigning delegate to a scope variable shouldn't allocate closure

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 24 08:17:24 UTC 2018


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

anonymous4 <dfj1esp02 at sneakemail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|safe                        |performance
            Summary|Closure allocation despite  |assigning delegate to a
                   |scope variable for ternary  |scope variable shouldn't
                   |operator / CondExp          |allocate closure
           Severity|major                       |enhancement

--- Comment #2 from anonymous4 <dfj1esp02 at sneakemail.com> ---
I've run into this myself :)
Simpler example:
---
void f() //@nogc
{
    int a;
    void g(){ a=1; }
    scope h=&g;
    h();
}
---
This shouldn't allocate closure because the delegate is assigned to a scope
variable.

--


More information about the Digitalmars-d-bugs mailing list