Error: this for ~this needs to be type foo not type foo[1u][1u]

d coder dlang.coder at gmail.com
Sun Feb 13 06:33:40 PST 2011


Greetings

I am getting this error when I am instantiating a struct array with a
single element inside another class and only if there is the
destructor for the struct is explicitly defined. Is it a known error?

Here is a minimized snippet that gives error:

$ rdmd --main -unittest test.d
Error: this for ~this needs to be type foo not type foo[1u][1u]
Error: this for ~this needs to be type foo not type foo[1u]


// test.d

struct foo {
  int foofoo;
  ~this() {			// no error if explicit destructor not
				// defined
  }
}

class bar {
  foo fred;
  foo[2][2] foofoo;
  foo[1] frop;			// this gives error
  foo[1][1] fropfrop;		// this too
}

unittest {
  foo frop;
  foo[1][1] fropfrop;		// this works
  bar burp;
}


More information about the Digitalmars-d-learn mailing list