[Issue 19095] New: Static initiatization statements of an array appeared in different kind of scopes have inconsistent semantics
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jul 18 13:57:15 UTC 2018
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 at puremagic.com
Reporter: kubo39 at 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
}
---
--
More information about the Digitalmars-d-bugs
mailing list