[Issue 21286] [DIP1000] Can't return scope reference from a function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Nov 17 20:28:14 UTC 2023


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

--- Comment #3 from Paul Backus <snarwin+bugzilla at gmail.com> ---
This also affects non-nested functions. For example:

---
ref int* getRef(return ref scope int* p) @safe
{
        return p;
}

void main() @safe
{
        int n;
        scope int* p;
        getRef(p) = &n;
}
---

I'm not sure if it's feasible to accept code like this without a full-blown
lifetime system like Rust's, but it would certainly be convenient if we could.

--


More information about the Digitalmars-d-bugs mailing list