[Issue 22990] New: [dip1000] extended return semantics doesn't work on auto return
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Apr 5 15:21:03 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=22990
Issue ID: 22990
Summary: [dip1000] extended return semantics doesn't work on
auto return
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: dkorpel at live.nl
```
auto assign(ref scope int* x, return ref int y) @safe
{
x = &y;
}
auto assign(ref scope int* x, return scope int* y) @safe
{
x = y;
}
```
Error: address of variable `y` assigned to `x` with longer lifetime
Error: scope variable `y` assigned to `x` with longer lifetime
Change the return type to `void` and it passes. The function `isFirstRef()`
returns false when the return type is not determined yet.
--
More information about the Digitalmars-d-bugs
mailing list