digitalmars.D.bugs - [Issue 20006] New: [REG 2.086.0] DIP1000: return scope ref outlives
- d-bugmail puremagic.com (31/31) Jun 25 2019 https://issues.dlang.org/show_bug.cgi?id=20006
https://issues.dlang.org/show_bug.cgi?id=20006 Issue ID: 20006 Summary: [REG 2.086.0] DIP1000: return scope ref outlives the scope of the argument Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: regression Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: belka caraus.de The following code doesn't compile with 2.085 (as expected): static struct Inserter { int* i; private this(return scope ref int) safe { } } auto func() safe { int i; return Inserter(i); } but compiles with 2.086. It should produce an error: "test.d(13): Error: returning Inserter(null).this(i) escapes a reference to local variable i". -preview=dip1000 is assumed in both cases. --
Jun 25 2019