Bug 24664 – Inconsistent "cannot be used as an lvalue in @safe code" deprecation

Status
NEW
Severity
minor
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2024-07-15T14:01:20Z
Last change time
2024-12-13T19:36:27Z
Keywords
safe
Assigned to
No Owner
Creator
Dennis
Moved to GitHub: dmd#20486 →

Comments

Comment #0 by dkorpel — 2024-07-15T14:01:20Z
``` void main() @safe { int[3] a; (cast(uint[3]) a)[0] = 20; // allowed assert(a[0] == 20); // passes (cast(uint[3]) a) = [30, 40, 50]; // Deprecation: cast from `int[3]` to `uint[3]` cannot be used as an lvalue in @safe code assert(a[0] == 30); } ``` Either both should compile, or neither.
Comment #1 by robert.schadek — 2024-12-13T19:36:27Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20486 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB