[Issue 17795] New: [scope] Scope errors not detected in ~= operation

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Aug 30 12:01:20 PDT 2017


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 at puremagic.com
          Reporter: bugzilla at 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];
}

--


More information about the Digitalmars-d-bugs mailing list