[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:42:28 UTC 2020


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

--- Comment #7 from johanengelen at weka.io ---
Another example that fails compilation:

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

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

// The explicit `scope` here is not used in `fooTemplate`
@nogc auto dosomething(scope S!int s)
{

}

@nogc auto fooTemplate() {
    int num;

    void foo() { int dummy = num; }

    dosomething(S!int(&foo));
}
```

--


More information about the Digitalmars-d-bugs mailing list