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

          Issue ID: 17718
           Summary: [scope] function literal arguments can be escaped
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: safe
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nob...@puremagic.com
          Reporter: c...@dawg.eu

cat > bug.d << CODE
@safe:

struct S
{
    int* p;
    int* leak() return scope { return p; }
}

alias f = function int*(scope S s) { return s.leak; }; // broken
int* f(scope S s) { return s.leak; } // works
CODE

dmd -c -dip1000 bug

--

Reply via email to