[Issue 22977] New: [dip1000] can escape scope pointer returned by nested function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Apr 3 10:05:39 UTC 2022


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

          Issue ID: 22977
           Summary: [dip1000] can escape scope pointer returned by nested
                    function
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: dkorpel at live.nl

Nested function `fn` does not get `return` inferred here:
```
int* gPtr;

void main() @safe
{
    scope int* sPtr;
    int* fn() { return sPtr; }
    gPtr = fn();
}
```

--


More information about the Digitalmars-d-bugs mailing list