[Issue 17470] New: [scope] this has longer lifetime then this
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Jun 5 09:01:26 PDT 2017
https://issues.dlang.org/show_bug.cgi?id=17470
Issue ID: 17470
Summary: [scope] this has longer lifetime then this
Product: D
Version: D2
Hardware: All
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: uplink.coder at googlemail.com
The following code:
@safe struct X {
byte[] s;
byte[9] a;
this(int n)
{
assert(n < 9);
s = a[0 .. n];
}
}
raises the error
t.d(8): Error: address of variable this assigned to this with longer lifetime
While infact, this has the exact same lifetime as this (it's the same pointer)
--
More information about the Digitalmars-d-bugs
mailing list