captain_fid:

struct S
{
  int a;
  string b;
}

class A
{
   S[] items;
   abstract void doit();
}

class B: A
{
this() {items = [ {10, "first"}, {20, "second"}];} // line 21
   override void doit() { }
}

(21): Error: found '}' when expecting ';' following statement
(21): Error: found ',' instead of statement

For reasons I don't know that {} syntax doesn't always work in D. So try:

this() {
    this.items = [S(10, "first"), S(20, "second")];
}

Bye,
bearophile

Reply via email to