In this case, the created struct literal A() will be moved out to the function getA(). So dtor is not called and compiler should not cause "cannot call impure function" error.

I filed a bug report and posted possible compiler fix.

http://d.puremagic.com/issues/show_bug.cgi?id=11286
https://github.com/D-Programming-Language/dmd/pull/2677

Kenji Hara
Nice, thank you!

Reply via email to