On Tuesday, 25 October 2022 at 13:51:30 UTC, Andrey Zherikov wrote:
Does the second piece of code shows a bug or my expectation is not correct (and why if so)?

This is a bug:

```d
void main()
{
  struct B
  {
    struct A
    {
      int i = 10;
    }
    A[] a = [A.init];
  }

  B[2] b;
  assert(b[0].a[0].i == 10);
  assert(b[1].a[0].i == 10);

  b[0].a[0].i = 1;
  assert(b[0].a[0].i == 1); // ok...
  assert(b[1].a[0].i == 1); // must be 10 !!!
}
```

SDB@79

Reply via email to