www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18830] New: Document Allowance for "new" with "scope" in

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 puremagic.com
          Reporter: madric 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();
}
```

--
May 05 2018