www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15824] New: 'scope' attribute ignored when making an alias to

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 puremagic.com
          Reporter: mathias.lang 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.

--
Mar 23 2016