On Wednesday, 10 August 2022 at 00:28:53 UTC, Steven
Schveighoffer wrote:
On 8/9/22 7:02 PM, Johan wrote:
Testcase:
```
shared int[int] aa;
void main () {
cast()aa[1] = 1;
}
```
If you use `cast()(aa[1]) = 1`, it has a range error even on
older versions.
That it ever worked is puzzling.
I think old compilers parsed it as `(cast()aa)[1]`, which works
on newer compilers too without range error.
In my case, `aa` is also `immutable`. The only way I know how to
make it work is now pretty ugly (casting away immutable should be
ugly, so perhaps it's OK...):
```
shared immutable int[int] aa;
void main () {
// (cast()aa)[1] = 1; // works without immutable
(*cast(int[int]*)(&aa))[1] = 1;
}
```