www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23773] New: array length assignment in assert condition

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

          Issue ID: 23773
           Summary: array length assignment in assert condition should
                    error
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: nick geany.org

int[] a;
    if (a.length = i) {} // error
    assert(a.length = i); // not caught

A variable assignment is caught:

    int i, j;
    if (i = j) {} // error
    assert(i = j); // error

--
Mar 11 2023