[Issue 5270] Using a scope delegate allows memory corruption in safe mode

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Aug 25 00:09:40 PDT 2016


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

--- Comment #7 from Walter Bright <bugzilla at digitalmars.com> ---
(In reply to timon.gehr from comment #2)
> The issue is that "it compiles and runs without error". (the second
> assertion asserts that there is memory corruption) The compiler has to
> either:
> 
> - enforce the 'scope' storage class in @safe mode by flow-analysis.
> - not perform the scope delegate optimization in @safe mode.
> 
> Change the second assertion to 'assert (x == 123);' to see the error.

Pull https://github.com/dlang/dmd/pull/5972 now causes:

test3.d(9): Error: scope variable dg assigned to non-scope globalDg

--


More information about the Digitalmars-d-bugs mailing list