On Sunday, 1 March 2015 at 08:57:17 UTC, Matthias Bentrup wrote:
Note that you can get the same issue without duplicate parameters, if you pass an alias to a global variable.

static A a;

void fun(A x) {
  a = null; // Releases x
  x.func();
}

void main() {
  a = new A();
  fun(a);
}

Well don't do that... :-)

Looks like a fly in the ointment. The most straightforward solution is to always add the opAdd/Release cycle when passing globals to impures. That's probably good enough. You probably don't pass a global to an impure very often anyway.

Reply via email to