[Issue 20006] New: [REG 2.086.0] DIP1000: return scope ref outlives the scope of the argument
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jun 25 17:22:56 UTC 2019
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 at puremagic.com
Reporter: belka at 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.
--
More information about the Digitalmars-d-bugs
mailing list