www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20747] New: live tracking of non-pointer owners not done

https://issues.dlang.org/show_bug.cgi?id=20747

          Issue ID: 20747
           Summary:  live tracking of non-pointer owners not done
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: bugzilla digitalmars.com

As reported by Timon Gehr in the n.g.:

void ignore(int* p){}
void main() live{
    int x=5;
    auto p=&x;
    x=3; // obsoletes p
    *p=4; // should fail
    ignore(p); // not necessary
}

void ignore(int* p){}
void main() live{
    int x=5;
    auto p=&x;
    *p=4;
    x=3;   // ok
    ignore(p); // not necessary
}

void main() live{
    int x=5;
    auto p=&x;
    auto q=&x;  // allow address to be taken multiple times
    *p=4;
    *q=5;
    writeln(*p," ",*q);
    ignore(p);
    ignore(q);
}

--
Apr 19 2020