https://issues.dlang.org/show_bug.cgi?id=23079
Issue ID: 23079
Summary: [dip1000] be more lenient when taking address of `ref`
return
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: safe
Severity: enhancement
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
Came up in the newsgroup:
https://forum.dlang.org/post/[email protected]
> Looks like the compiler has a blanket rule against taking the address
> of a ref return value if the value's type contains indirections.
```
int** p;
ref int* get() @safe
{
return *p;
}
int** g1() @safe
{
return &get(); // error
}
```
DMD could figure out get() does not return a scope pointer and allow taking the
address of its return value.
--