Bug 22801 – [REG 2.099.0-beta.1] Can't return address of return ref parameter from constructor

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-02-21T14:40:27Z
Last change time
2022-04-01T15:02:25Z
Keywords
pull
Assigned to
No Owner
Creator
Paul Backus

Comments

Comment #0 by snarwin+bugzilla — 2022-02-21T14:40:27Z
Using -preview=dip1000, the following program compiles successfully when using DMD 2.098.1, but fails when using DMD 2.099.0-beta.1: --- struct Wrapper { int* ptr; this(return ref int var) @safe { this.ptr = &var; } } void main() @safe { int i; auto w = Wrapper(i); } --- The error message is: --- bug.d(7): Error: address of variable `var` assigned to `this` with longer lifetime ---
Comment #1 by moonlightsentinel — 2022-02-21T14:42:02Z
Comment #2 by dlang-bot — 2022-02-21T21:10:49Z
@dkorpel created dlang/dmd pull request #13699 "Fix Issue 22801 - Can't return address of return ref parameter from constructor" fixing this issue: - Fix Issue 22801 - Can't return address of return ref parameter from constructor https://github.com/dlang/dmd/pull/13699
Comment #3 by dlang-bot — 2022-04-01T13:04:14Z
@dkorpel created dlang/dmd pull request #13940 "Fix Issue 22801 - [master] Can't return address of return ref parameter from constructor" fixing this issue: - Fix Issue 22801 - Can't return address of return ref parameter from constructor https://github.com/dlang/dmd/pull/13940
Comment #4 by dlang-bot — 2022-04-01T15:02:25Z
dlang/dmd pull request #13940 "Fix Issue 22801 - [master] Can't return address of return ref parameter from constructor" was merged into master: - 6fe45bc5418216449295a58e24c3b339cdc9fc6e by dkorpel: Fix Issue 22801 - Can't return address of return ref parameter from constructor https://github.com/dlang/dmd/pull/13940