struct Bar {
int value;
}
void main() {
auto bar = Bar(42);
(cast(Bar[1])bar)[] = Bar(1); // OK!
assert(bar.value == 1);
int foo = 42;
(cast(int[1])foo)[] = 1; // Error: cannot cast expression `foo` of type `int` to `int[1]`
assert(foo == 1);
}
It is occasionally useful to be able to slice scalars (for use with std.stdio.File.rawWrite, for example), so I would like to see this more consistently supported.