Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
September 30, 2022 [Issue 23381] null/init are not accepted as initializers of a zero-sized static array | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23381 Max Samukha <maxsamukha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rejects-valid Hardware|x86 |All OS|Windows |All Severity|enhancement |normal -- |
October 03, 2022 [Issue 23381] null/init are not accepted as initializers of a zero-sized static array | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23381 Nick Treleaven <nick@geany.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nick@geany.org --- Comment #1 from Nick Treleaven <nick@geany.org> --- > int[0] a1 = null; // ok I don't think that should work - a static array is not a reference. Just use `[]` or init. Especially as there are no compile-time errors when the array length is > 0 for null, but there are for `[]`: void f() { int[1] b = []; // error int[1] a = null; // no error a = []; // error a = null; // no error } -- |
October 04, 2022 [Issue 23381] null/init are not accepted as initializers of a zero-sized static array | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23381 --- Comment #2 from Max Samukha <maxsamukha@gmail.com> --- (In reply to Nick Treleaven from comment #1) > > int[0] a1 = null; // ok > > I don't think that should work - a static array is not a reference. Just use `[]` or init. Especially as there are no compile-time errors when the array length is > 0 for null, but there are for `[]`: > > void f() > { > int[1] b = []; // error > int[1] a = null; // no error > a = []; // error > a = null; // no error > } If null is implicitly convertable to a dynamic array type, I believe it should be accepted anywhere a dynamic array is accepted. void f() { > int[1] a = null; // no error > a = null; // no error } Those produce a rangle violation error at runtime. If size mismatches can be detected for [] at compile time, why can't they for 'null'? -- |
December 17, 2022 [Issue 23381] null/init are not accepted as initializers of a zero-sized static array | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23381 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P3 -- |
December 13 [Issue 23381] null/init are not accepted as initializers of a zero-sized static array | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23381 --- Comment #3 from dlangBugzillaToGithub <robert.schadek@posteo.de> --- THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20160 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB -- |
Copyright © 1999-2021 by the D Language Foundation