[Issue 22541] DIP1000: Resolve ambiguity of ref-return-scope parameters

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 16 13:25:55 UTC 2022


https://issues.dlang.org/show_bug.cgi?id=22541

Dennis <dkorpel at live.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #7 from Dennis <dkorpel at live.nl> ---
As mentioned in the PR, that was only a partial fix, this still fails:
```
struct S 
{
    int i;
    int* ptr;

    int* wannabeReturnRef() scope return
    {
        return &i;
    }
}
```

Error: returning `&this.i` escapes a reference to parameter `this`
       perhaps remove `scope` parameter annotation so `return` applies to `ref`

--


More information about the Digitalmars-d-bugs mailing list