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. what's going on? have i misread the spec?

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 distinction there, despite
the code looking the same.

This works:

```d
class Example {
    double[6][3] matrix;
    this() {
        matrix = 0;
    }
}
```

Reply via email to