September 08, 2008 [Issue 2348] New: T.init == void ==> T[1] rejected | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=2348 Summary: T.init == void ==> T[1] rejected Product: D Version: 1.035 Platform: PC OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: svv1999@hotmail.com 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. -- |
September 11, 2008 [Issue 2348] T.init == void ==> T[1] rejected | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2348 svv1999@hotmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID ------- Comment #1 from svv1999@hotmail.com 2008-09-11 06:49 ------- 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 -- |
Copyright © 1999-2021 by the D Language Foundation