[Issue 19682] New: Unused alias causes @nogc error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Feb 17 03:40:07 UTC 2019


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

          Issue ID: 19682
           Summary: Unused alias causes @nogc error
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: andy.pj.hanson at gmail.com

```d
@nogc:

void foo(alias cb)() {}

void main() {
        int x = 0;
        foo!(() => x)();
}
```

I would expect the code to compile since the closure is inside an alias.
The code does compile if I change `foo` to `void foo(alias cb)() { cb(); }`.

--


More information about the Digitalmars-d-bugs mailing list