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

--- Comment #4 from Walter Bright <bugzi...@digitalmars.com> ---
(In reply to Rainer Schuetze from comment #3)
> Are you saying that it is ok that adding -dip1000 can change code gen so
> that it crashes?

Yes. This is because 'scope' for delegates now means something with dip1000, it
means the delegate must not escape. If it does, and this is not checked for in
non-@safe functions, it will likely crash.


> I don't see anything unsafe and invalid in the original code. Could you
> elaborate? Please note that it it also in the dmd test suite.

The problem is the delegate escapes from its stack frame, and no closure was
allocated.

The scope checking with delegates is a backwards compatibility thing, as people
often pass scope delegates to non-scope delegate parameters.

--

Reply via email to