struct X {
  int a;
  int * ptr;
};

void ?{}(X & this) {
  printf("default constructing\n");
  (this.a){ 123 };
  this.ptr = (int *)malloc(sizeof(int));
}

void ?{}(X & this, X other) {
  printf("copy constructing\n");
  (this.a){ other.a };
  this.ptr = (int *)malloc(sizeof(int));
}

void ?{}(X & this, int a) {
  printf("constructing with %d\n", a);
  (this.a){ a };
  this.ptr = (int *)malloc(sizeof(int));
}

void ^?{}(X & this) {
  printf("destructing\n");
  free(this.ptr);
}

X ?=?(X & this, X other) {
  this.a = other.a;
  return this;
}

X global[10][10] = {
  { 1, { 2 }, { 3 }, { 4 }, 5, 6, 7, 8, 9, 10, 11, 12 },
  { 1, 2, 3, 4 },
  { { 1234567 } }
};

X global2[3][3][3] = {
  {
    { 1, 2, 3 },
    { 4, 5, 6 },
    { 7, 8, 9 },
    { 10, 11, 12 }
  },
  {
    { 0, 0, 0 }
  }
};

int foo() {
  static X abc[3][3] = {
    { 11, 22, 33, 44 },
    { 55, 66 },
    { 77 },
    { 88, 99, 1010 }
  };
}

// ensure constructed const arrays continue to compile
const int global[1] = { -2 };

int main() {
  X abc[4][4] = {
    { 999, 1111 },
    { 1, 2, 3, 4, 5 },
    {},
    { 0 },
    { 88 }
  };

  foo();
  foo();
}
