Bug 20597 – [REG2.080] Wrong closure GC allocation with dip1000

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-02-22T22:37:48Z
Last change time
2020-04-14T16:26:04Z
Keywords
industry, pull, rejects-valid
Assigned to
No Owner
Creator
johanengelen
See also
https://issues.dlang.org/show_bug.cgi?id=20596

Comments

Comment #0 by johanengelen — 2020-02-22T22:37:48Z
The following code used to compile with -dip1000 but no longer does since DMD2.080: ``` @nogc void g(T)(scope T args) {} @nogc void foo(T)(scope T args) { scope dg = () { g(args); }; } void main() { foo("hoi"); } ``` dmd -dip1000 onlineapp.d: onlineapp.d(3): Error: function `onlineapp.foo!string.foo` is `@nogc` yet allocates closures with the GC onlineapp.d(4): onlineapp.foo!string.foo.__lambda2 closes over variable args at onlineapp.d(3) onlineapp.d(8): Error: template instance `onlineapp.foo!string` error instantiating
Comment #1 by bugzilla — 2020-04-06T09:42:52Z
Comment #2 by dlang-bot — 2020-04-07T09:59:01Z
@WalterBright updated dlang/dmd pull request #11006 "fix Issue 20596 - [REG2.086] Error on missed stack allocation for clo…" fixing this issue: - fix Issues 20596, 20597 - Error on missed stack allocation for closure for template https://github.com/dlang/dmd/pull/11006
Comment #3 by dlang-bot — 2020-04-14T16:26:04Z
dlang/dmd pull request #11006 "fix Issues 20596, 20967 - [REG2.086] Error on missed stack allocation for clo…" was merged into master: - 3d746b956b85d07646fe901d5e705306ab5027b9 by Walter Bright: fix Issues 20596, 20597 - Error on missed stack allocation for closure for template https://github.com/dlang/dmd/pull/11006