[Issue 2043] Closure outer variables in nested blocks are not allocated/instantiated correctly: should have multiple instances but only have one.

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri May 1 15:21:29 PDT 2015


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

Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Hardware|x86                         |All
                 OS|Windows                     |All

--- Comment #21 from Walter Bright <bugzilla at digitalmars.com> ---
The most practical solution is to simply disallow referencing variables from a
dynamic closure that end sooner than the closing } of the function.

This leaves it up to the user to decide how to handle it, such as passing the
variable explicitly as an argument, declaring the variable at function scope,
or copying the variable to another declared at function scope.

--


More information about the Digitalmars-d-bugs mailing list