On Friday, 11 June 2021 at 08:30:29 UTC, Moth wrote:
what's going on?
It's a bug:
[Issue 19178 - Static initialization of 2d static arrays in
structs produces garbage or doesn't compile
sometimes](https://issues.dlang.org/show_bug.cgi?id=19178)
On Friday, 11 June 2021 at 08:40:51 UTC, jfondren wrote:
The example in the spec is in a function body and you've copied
it to a class body, where the writeln() would also be in error.
I find https://dlang.org/spec/grammar.html quite hard to read
but I imagine there's a state/declaration distinc
On Friday, 11 June 2021 at 08:30:29 UTC, Moth wrote:
```
class ExampleClass
{
double[6][3] matrix = 0; //fails to compile - "Error:
cannot implicitly convert expression `0` of type `int` to
`double[6][3]`"
}
```
evidently i'm doing something wrong here, but i can't
understand what or why
hullo all. i've encountered a bizzare inconsistency.
the following is the [D spec on rectangular
arrays](https://dlang.org/spec/arrays.html#rectangular-arrays):
```
void main()
{
import std.stdio: write, writeln, writef, writefln;
double[6][3] matrix = 0; // Sets all elements to 0.