[Issue 23530] casting immutable away allowed in safe
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Sep 10 10:33:13 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=23530
--- Comment #3 from Dlang Bot <dlang-bot at 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
--
More information about the Digitalmars-d-bugs
mailing list