www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18283] New: -dip1000 doesn't catch invalid local reference


          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 puremagic.com
          Reporter: slavo5150 yahoo.com

import std.stdio;

void main()  safe
    string foo = "foo";
    string* ls0;
    string* p1, p2;

    ls0 = &foo;
    p1 = ls0;
    p2 = ls0;

Compile with `-dip1000`

Error: program killed by signal 11


Compiling the same example without `-dip1000`, I get:

onlineapp.d(9): Error: cannot take address of local foo in  safe function main


Though this could be an issue with `destroy()`.  Not sure.

Jan 22 2018