D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 20597 - [REG2.080] Wrong closure GC allocation with dip1000
Summary: [REG2.080] Wrong closure GC allocation with dip1000
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 regression
Assignee: No Owner
URL:
Keywords: industry, pull, rejects-valid
Depends on:
Blocks:
 
Reported: 2020-02-22 22:37 UTC by johanengelen
Modified: 2020-04-14 16:26 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description johanengelen 2020-02-22 22:37:48 UTC
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 Walter Bright 2020-04-06 09:42:52 UTC
Fixed by https://github.com/dlang/dmd/pull/11006
Comment 2 Dlang Bot 2020-04-07 09:59:01 UTC
@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 Dlang Bot 2020-04-14 16:26:04 UTC
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