[Issue 18830] New: Document Allowance for "new" with "scope" in @nogc Functions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat May 5 14:26:28 UTC 2018


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

          Issue ID: 18830
           Summary: Document Allowance for "new" with "scope" in @nogc
                    Functions
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dlang.org
          Assignee: nobody at puremagic.com
          Reporter: madric at gmail.com

For the description for @nogc functions as found here:
https://dlang.org/spec/function.html#nogc-functions

It is not indicated that "new" declarations may be compatible with "@nogc"
functions provided that they are only used for "scope" variables.  The
following program compiles on the dlang.org website:

```
class Bob {
        int a;
}

void doThing() @nogc {
        scope auto b = new Bob();
}

void main() {
        doThing();
}
```

--


More information about the Digitalmars-d-bugs mailing list