March 03, 2022 [Issue 22840] New: [dip1000] inout method with inferred @safe escapes local data | ||||
|---|---|---|---|---|
| ||||
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. -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply