void main(){
typedef ubyte B=void;
B[1] b; // Error: void initializer has no value
}
The initializing procedure for static arrays should be smart enough to not try to initialize the elements, whenever for the underlying type T `.init' is `void'.
For dynamic arrays the initializer, changed by the same typedef, seems to be ignored.
Comment #1 by svv1999 — 2008-09-11T06:49:16Z
dmd handles this case correctly, because overloading the meaning of `void' in `T= void' with "do not initialize `T'" seems wrong.
An initializer of `T= void' should have the semantics, that declaring a variable `v' of type `T' without initializer is rejected, as it is exposed in the example given.
typedef ubyte B=void;
B[1] b=0; // works as expected