[Issue 17718] New: [scope] function literal arguments can be escaped

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Aug 3 11:44:47 PDT 2017


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

--


More information about the Digitalmars-d-bugs mailing list