www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23137] New: Matrix initialization at global scope

https://issues.dlang.org/show_bug.cgi?id=23137

          Issue ID: 23137
           Summary: Matrix initialization at global scope
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: rdm e.email

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;
}
```

--
May 25 2022