On Wednesday, 6 February 2013 at 21:52:01 UTC, Maxim Fomin wrote:

but this(const this) is supported and means to be a constructor

Maxim, please review this thread: http://forum.dlang.org/post/[email protected]

In this example the 'this(const this)' is not called, just as pointed out in the previous thread. That is, things have not changed. So, in following, "Hi" is not printed. Have you had any luck with 'this(const this)'?

Thanks
Dan

import std.stdio;

struct X {
  char[] c;
  this(char[] c_) { c = c_.dup; }
  this(const this) {
    writeln("Hi");
  }
}

void main() {
  auto const x = X(['a']);
  const(X) x2 = x;
  writeln("Done");
}

Reply via email to