[Issue 18088] New: wrong lifetime evaluation of pointers or this-pointers in a struct with @safe
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Dec 16 18:16:20 UTC 2017
https://issues.dlang.org/show_bug.cgi?id=18088
Issue ID: 18088
Summary: wrong lifetime evaluation of pointers or this-pointers
in a struct with @safe
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: mephisto at nordhoff-online.de
file: app.d
~~~~~~~~~~~~~~~~~~~~~
void main() {
A a = A( true);
}
@safe
struct A {
bool *lala;
this( bool i) {
lala = &aVar;
}
bool aVar = true;
}
~~~~~~~~~~~~~~~~~~~~~
$ dmd --version
DMD64 D Compiler v2.077.1
...
$
$ dmd app.d
app.d(13): Error: address of variable this assigned to this with longer
lifetime
$
I would say the lifetime of "this" is equal to the lifetime of "this", but not
longer
--
More information about the Digitalmars-d-bugs
mailing list