www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17718] New: [scope] function literal arguments can be escaped

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: nobody puremagic.com
          Reporter: code 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

--
Aug 03 2017