April 05, 2022 [Issue 22990] New: [dip1000] extended return semantics doesn't work on auto return | ||||
|---|---|---|---|---|
| ||||
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@puremagic.com Reporter: dkorpel@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. -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply