[Issue 18283] New: -dip1000 doesn't catch invalid local reference
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jan 23 02:43:10 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18283
Issue ID: 18283
Summary: -dip1000 doesn't catch invalid local reference
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: slavo5150 at yahoo.com
import std.stdio;
void main() @safe
{
string foo = "foo";
string* ls0;
string* p1, p2;
ls0 = &foo;
p1 = ls0;
ls0.destroy();
p2 = ls0;
writeln(p2.length);
}
Compile with `-dip1000`
Error: program killed by signal 11
https://run.dlang.io/is/6L6zcH
========================================
Compiling the same example without `-dip1000`, I get:
onlineapp.d(9): Error: cannot take address of local foo in @safe function main
https://run.dlang.io/is/rHpuf1
Though this could be an issue with `destroy()`. Not sure.
--
More information about the Digitalmars-d-bugs
mailing list