digitalmars.D.bugs - [Issue 22840] New: [dip1000] inout method with inferred safe
- d-bugmail puremagic.com (34/34) Mar 03 2022 https://issues.dlang.org/show_bug.cgi?id=22840
https://issues.dlang.org/show_bug.cgi?id=22840 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 error. --
Mar 03 2022