[Issue 17725] New: [scope] escape from nested function to enclosing local

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Aug 6 15:37:05 PDT 2017


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

          Issue ID: 17725
           Summary: [scope] escape from nested function to enclosing local
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: bugzilla at digitalmars.com

>From Rainer:

  void test() @safe {
    int* p;
    struct T {
        int a;
    }
    void escape(ref T t) @safe {
        p = &t.a; // should not compile
    }

    {
        T t;
        escape(t);
    }
    auto bug = *p;
  }

Compile with -dip1000

--


More information about the Digitalmars-d-bugs mailing list