Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
December 02, 2022 [Issue 23530] casting immutable away allowed in safe | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23530 RazvanN <razvan.nitu1305@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |razvan.nitu1305@gmail.com --- Comment #1 from RazvanN <razvan.nitu1305@gmail.com> --- dip1000 is not needed to reproduce this: @safe void main() { immutable int x = 5; //alternatively const int* b = &(cast()x); } This used to fail compilation with a wrong error message: Error: `cast(int)x` is not an lvalue and cannot be modified. So I assume that at some point it wasn't possible to take the address of a cast. When safe was implemented they probably took this into account and later on when the cast was allowed someone probably forgot to update the safety check. -- |
December 02, 2022 [Issue 23530] casting immutable away allowed in safe | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23530 Dlang Bot <dlang-bot@dlang.rocks> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull --- Comment #2 from Dlang Bot <dlang-bot@dlang.rocks> --- @RazvanN7 created dlang/dmd pull request #14668 "Fix Issue 23530 - casting immutable away allowed in safe" fixing this issue: - Fix Issue 23530 - casting immutable away allowed in safe https://github.com/dlang/dmd/pull/14668 -- |
December 17, 2022 [Issue 23530] casting immutable away allowed in safe | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23530 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P2 -- |
September 10 [Issue 23530] casting immutable away allowed in safe | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23530 --- Comment #3 from Dlang Bot <dlang-bot@dlang.rocks> --- @ntrel created dlang/dmd pull request #15597 "Add CastExp.toLvalue obsolete warning if implicit pointer conversion would fail" fixing this issue: - Add CastExp.toLvalue -wo warning if implicit pointer conv would fail From https://dlang.org/spec/expression.html#.define-lvalue > The following expressions, and no others, are called lvalue expressions or lvalues ... > cast(U) expressions applied to lvalues of type T when T* is implicitly convertible to U*; > cast() and cast(qualifier list) when applied to an lvalue. The first rule was not enforced by dmd. The second rule contradicts the point of the first rule. It should be updated to work in the same way. Fixes Issue 23530 - casting immutable away allowed in safe. https://github.com/dlang/dmd/pull/15597 -- |
September 10 [Issue 23530] casting immutable away allowed in safe | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23530 Nick Treleaven <nick@geany.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |safe CC| |nick@geany.org -- |
March 24 [Issue 23530] casting immutable away allowed in safe | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23530 --- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> --- @ntrel updated dlang/dmd pull request #16315 "Fix Bugzilla 24434 - Casting away const with cast() is not a @safe lv…" fixing this issue: - Workaround for safe append Fixes Bugzilla 23530 - casting immutable away allowed in safe. https://github.com/dlang/dmd/pull/16315 -- |
Copyright © 1999-2021 by the D Language Foundation