2013/6/4 Don <[email protected]>
>
> There is still one problem, bug 10198. This currently compiles, and does
> something stupid:
> ---
>
> struct U {
> int [3][3] y;
> }
>
> U u = U(4);
> ---
> What do you think should happen here?
>
Oh! I did not know it is currently accepted.
I think accepting multi-dimensional block initializing on StructLiteralExp
arguments is very bug-prone behavior.
Different from variable declaration in statement scope, there is no target
type we can look for. So inferring the cost of static array construction is
difficult.
struct U { int[3][3][3][3] w; }
U u = U(1); // looks trivial, but actually costly operation.
int[3][3][3][3] w = 1; // initializing cost is very obvious
At most it would be better that it is restricted up to one-dimensional
block initializing, same as StructInitializer.
Kenji Hara