Bug 24609 – Array of struct with immutable field implicitly converts to void[]

Status
NEW
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2024-06-15T11:53:42Z
Last change time
2024-12-13T19:35:42Z
Assigned to
No Owner
Creator
Nick Treleaven
Moved to GitHub: dmd#18246 →

Comments

Comment #0 by nick — 2024-06-15T11:53:42Z
void main() @system { S[] a = [S(5)]; //a[0] = S(0); // error, modifying immutable member of S void[] va = a; // need to disallow va[] = [0]; // corrupt a[0] assert(a[0].i == 5); // fails } struct S { const int i; } Should be disallowed with -preview=fixImmutableConv.
Comment #1 by robert.schadek — 2024-12-13T19:35:42Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18246 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB