www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22840] New: [dip1000] inout method with inferred safe


          Issue ID: 22840
           Summary: [dip1000] inout method with inferred  safe escapes
                    local data
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dkorpel live.nl

issue 20149 was closed with a partial fix. The fix doesn't work when ` safe` is
inferred, example:
struct S
    int buf;
    auto slice() inout
        return &buf;

int* fun()  safe
    S sb;
    return sb.slice(); // should error
Remove `inout` or add explicit ` safe` to `slice` and it correctly raises an

Mar 03 2022