On Wednesday, 19 July 2017 at 12:23:06 UTC, Danni Coy wrote:
On Wed, Jul 19, 2017 at 7:09 PM, Stefan Koch via Digitalmars-d < digitalmars-d@puremagic.com> wrote:


What happens is this.

void open()
{
  foo = () {
  Foo _tmp = Foo.__ctor("test");
  return _tmp;
  } ();
}


Error: need 'this' for 'this' of type 'ref Foo(string s)'

I posted pseudo code to show you that you are creating a temporary.
Which leaves the scope after assigning.
And therefore triggers the destructor.

Reply via email to