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