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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Mar 13 16:30:11 UTC 2023


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

RazvanN <razvan.nitu1305 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |razvan.nitu1305 at gmail.com
         Resolution|---                         |INVALID

--- Comment #2 from RazvanN <razvan.nitu1305 at gmail.com> ---
But I do get an error:

test.d(5): Error: cannot modify constant `a.length`

And that happens because `a.length = i` gets analyzed before the compiler gets
the chance to error about the assert. It makes sense that the assignment needs
to be semantically correct before it's checked if it's in an assert.

I don't think this bug report is valid.

--


More information about the Digitalmars-d-bugs mailing list