digitalmars.D.bugs - [Issue 18090] New: missleading Error-Message when assigning pointers
- d-bugmail puremagic.com (40/40) Dec 16 2017 https://issues.dlang.org/show_bug.cgi?id=18090
https://issues.dlang.org/show_bug.cgi?id=18090 Issue ID: 18090 Summary: missleading Error-Message when assigning pointers in safe struct Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: mephisto 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 $ The error message makes sense, but it may take a while to see the problem. Maybe it would be worth mentioning that `this` is a value type who can be copied. --
Dec 16 2017