March 22, 2022 [Issue 22910] New: [dip1000] return scope struct member functions allow returning `this` by ref | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22910 Issue ID: 22910 Summary: [dip1000] return scope struct member functions allow returning `this` by ref Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: safe Severity: normal Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: dkorpel@live.nl This should give an error since the function is `return scope`, while it should be `return ref` for returning a reference to `this`: ``` struct S { int val; int* ptr; int* retScope() return scope { return &this.val; } } ``` -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply