[Issue 20596] [REG2.086] Error on missed stack allocation for closure for template

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Aug 9 10:30:32 UTC 2020


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

johanengelen at weka.io changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #6 from johanengelen at weka.io ---
Reopening, because the regression is not entirely fixed.
See this slightly modified testcase, where variable `s` is not explicitly
marked `scoped`. The compiler does not deduce `scope` for `s`. This used to
compile and not GC-allocate (<= 2.085) but no longer does.

```
 struct S(T) {
    void delegate() dg;

    this(scope void delegate() dg)
    {
        this.dg = dg;
    }
 }

 @nogc void fooTemplate() {
    int num;

    void foo() { int dummy = num; }

    auto s = S!int(&foo); // not explicitly defined as `scope`
 }
```

--


More information about the Digitalmars-d-bugs mailing list