[Issue 15824] New: 'scope' attribute ignored when making an alias to a scope delegate

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Mar 23 07:48:01 PDT 2016


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

          Issue ID: 15824
           Summary: 'scope' attribute ignored when making an alias to a
                    scope delegate
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: mathias.lang at sociomantic.com

The following code fails to compile:

```
alias scope void delegate() AltDg;

void foo (AltDg dg) @nogc {}
void main () @nogc {
    uint i;
    foo(() { i = 1; });
}
```

Error message:
`foo.d(4): Error: function D main @nogc function allocates a closure with the
GC`

Using `void foo (scope AltDg dg) @nogc {}` works fine.

--


More information about the Digitalmars-d-bugs mailing list