www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18644] New: [dip1000] escape of outer local not detected

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

          Issue ID: 18644
           Summary: [dip1000] escape of outer local not detected
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: bugzilla digitalmars.com

Consider:

   safe void test() {
    int i;

    int*[] a = [&i];  // error detected correctly

    int* foo() { return &i; }
    int*[] b = [foo()]; // should detect error
  }

--
Mar 21 2018