Bug 2348 – T.init == void ==> T[1] rejected

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2008-09-08T07:53:00Z
Last change time
2014-03-01T00:37:04Z
Keywords
rejects-valid
Assigned to
bugzilla
Creator
svv1999

Comments

Comment #0 by svv1999 — 2008-09-08T07:53:02Z
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