[Issue 23773] New: array length assignment in assert condition should error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 11 14:34:16 UTC 2023


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 at puremagic.com
          Reporter: nick at 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

--


More information about the Digitalmars-d-bugs mailing list