[Issue 15718] use ref or out parameters in the anonymous method may cause error
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Nov 3 09:56:12 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=15718
RazvanN <razvan.nitu1305 at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |razvan.nitu1305 at gmail.com
Resolution|--- |WONTFIX
--- Comment #1 from RazvanN <razvan.nitu1305 at gmail.com> ---
What happens here is that you are creating a delegate that receives some stack
pointers. When the delegate is actually called it ends up modifying an expired
stack frame (which coincidentally points to the current frame).
Although this is problematic, I would argue that it is a code problem, not a
compiler one. What should the compiler be doing here? I guess that in @safe
code it should not allow the references to a, b, and c escape the scope of
test1. However, this bug report already exists:
https://issues.dlang.org/show_bug.cgi?id=23438 .
I will close this as WONTFIX because this system code is ok from a compiler
perspective.
--
More information about the Digitalmars-d-bugs
mailing list