[Issue 24664] New: Inconsistent "cannot be used as an lvalue in @safe code" deprecation
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jul 15 14:01:20 UTC 2024
https://issues.dlang.org/show_bug.cgi?id=24664
Issue ID: 24664
Summary: Inconsistent "cannot be used as an lvalue in @safe
code" deprecation
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: safe
Severity: minor
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: dkorpel at live.nl
```
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.
--
More information about the Digitalmars-d-bugs
mailing list