www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17795] New: [scope] Scope errors not detected in ~= operation

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

          Issue ID: 17795
           Summary: [scope] Scope errors not detected in ~= operation
           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 Mathias Lang:

// Compiles with -dip1000, but should not

void main ()  safe
{
    int* ptr = bar();
    assert(ptr !is null);
}

int* bar ()  safe
{
    int i;
    int*[][] arr = new int*[][](1);
    arr[0] ~= &i;
    return arr[0][0];
}

--
Aug 30