Bug 19962 – [DIP1000] scope on delegate no affect with DIP1000

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-06-14T09:35:43Z
Last change time
2021-01-13T21:34:51Z
Keywords
safe
Assigned to
No Owner
Creator
Jacob Carlborg

Comments

Comment #0 by doob — 2019-06-14T09:35:43Z
The following code snippet compiles successfully WITHOUT DIP1000 enabled: void main(string[] args) @safe @nogc { scope f = () { auto a = args; }; } But compiling the same code WITH DIP100 enabled, the following compile error occurs: main.d(1): Error: function `D main` is @nogc yet allocates closures with the GC main.d(3): main.main.__lambda2 closes over variable args at main.d(1)
Comment #1 by qs.il.paperinik — 2021-01-13T21:34:51Z
Has been fixed in 2.092.1.