[Issue 23137] New: Matrix initialization at global scope

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed May 25 08:32:08 UTC 2022


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 at puremagic.com
          Reporter: rdm at 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;
}
```

--


More information about the Digitalmars-d-bugs mailing list