digitalmars.D.bugs - [Issue 19095] New: Static initiatization statements of an array
- d-bugmail puremagic.com (30/30) Jul 18 2018 https://issues.dlang.org/show_bug.cgi?id=19095
https://issues.dlang.org/show_bug.cgi?id=19095 Issue ID: 19095 Summary: Static initiatization statements of an array appeared in different kind of scopes have inconsistent semantics Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: trivial Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: kubo39 gmail.com I think this is not a bug, but it seems like unnatural behavior. --- auto foo() { return [1]; } int[2] ARR = [1]; int[2] ARR_2 = foo(); // Error: mismatched array lengths, 2 and 1 void main() { assert(ARR == [1, 0]); // Success. int[2]arr = [1]; // Error: mismatched array lengths, 2 and 1 } --- --
Jul 18 2018