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; } } ```
@dkorpel created dlang/dmd pull request #13860 "Fix issue 22910 - `return scope` struct member functions allow returning `this` by ref" fixing this issue: - Fix issue 22910 - `return scope` struct member functions allow returning `this` by ref https://github.com/dlang/dmd/pull/13860
dlang/dmd pull request #13860 "Fix issue 22910 - `return scope` struct member functions allow returning `this` by ref" was merged into master: - 31f410b04fde66afadebf6ae2da289b37ef626d7 by Dennis Korpel: Fix issue 22910 - `return scope` struct member functions allow returning `this` by ref https://github.com/dlang/dmd/pull/13860