Thread overview |
---|
March 11, 2023 [Issue 23773] array length assignment in assert condition should error | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23773 --- Comment #1 from Nick Treleaven <nick@geany.org> --- Looks like this code needs modifying: https://github.com/dlang/dmd/pull/12165 -- |
March 13, 2023 [Issue 23773] array length assignment in assert condition should error | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23773 RazvanN <razvan.nitu1305@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |razvan.nitu1305@gmail.com Resolution|--- |INVALID --- Comment #2 from RazvanN <razvan.nitu1305@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. -- |
March 13, 2023 [Issue 23773] array length assignment in assert condition should error | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23773 --- Comment #3 from RazvanN <razvan.nitu1305@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. -- |
March 13, 2023 [Issue 23773] array length assignment in assert condition should error | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23773 RazvanN <razvan.nitu1305@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|INVALID |--- -- |
March 13, 2023 [Issue 23773] array length assignment in assert condition should error | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23773 --- Comment #4 from RazvanN <razvan.nitu1305@gmail.com> --- Scratch that, when I tested locally I had a static array, instead of a dynamic one. The bug report is valid. -- |
March 14, 2023 [Issue 23773] array length assignment in assert condition should error | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23773 --- Comment #5 from RazvanN <razvan.nitu1305@gmail.com> --- Well, the compiler rewrites `a.length = i` to `_d_arraysetlengthT(a, i)` so that's why the assert error is not caught. -- |
March 14, 2023 [Issue 23773] array length assignment in assert condition should error | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23773 --- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> --- @RazvanN7 created dlang/dmd pull request #14985 "Add a lowering field for AssignExp to store potential lowerings" mentioning this issue: - Add a lowering field for AssignExp to store potential lowerings and use it for array length expressions + Fix Issue 23773 https://github.com/dlang/dmd/pull/14985 -- |
March 31, 2023 [Issue 23773] array length assignment in assert condition should error | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23773 Dlang Bot <dlang-bot@dlang.rocks> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution|--- |FIXED --- Comment #7 from Dlang Bot <dlang-bot@dlang.rocks> --- dlang/dmd pull request #14985 "Add a `lowering` field for AssignExp to store potential lowerings" was merged into master: - e6df5b96bcf1c38f44d3a151fdaf6a2381e17564 by RazvanN7: Fix Issue 23773 - Add a lowering field for AssignExp to store potential lowerings and use it for array length expressions https://github.com/dlang/dmd/pull/14985 -- |
Copyright © 1999-2021 by the D Language Foundation