Bug 23137 – Matrix init rejected in module scope but accepted at function scope

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-05-25T08:32:08Z
Last change time
2022-06-21T15:44:45Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
rm

Comments

Comment #0 by rdm — 2022-05-25T08:32:08Z
The following code does no compile with the error: onlineapp.d(3): Error: cannot implicitly convert expression `0` of type `int` to `int[6][3]` But for the simpler case of vector and if the matrix is in a function scope it works, just like the specification states https://dlang.org/spec/arrays.html#rectangular-arrays ```d import std; int[6][3] matrix = 0; int[6] vector = 0; void main() { int[6][3] stackMatrix = 0; } ```
Comment #1 by dkorpel — 2022-06-21T15:44:45Z
*** This issue has been marked as a duplicate of issue 19178 ***