struct S {
int[] a;
}
enum s = S(new int[1]);
int[1] a = s.a;
void main() {
}
onlineapp.d(8): Error: cannot cast expression S([0]).a of type int[] to int[1]
Compiles if S is constructed directly in the initializer:
int[1] a = S(new int[1]).a; // ok
Comment #1 by nick — 2024-11-24T20:21:42Z
Workaround - use `[]`:
int[1] a = s.a[];
Comment #2 by robert.schadek — 2024-12-13T19:13:09Z