On Saturday, 27 July 2019 at 17:13:45 UTC, Adam D. Ruppe wrote:
If you change that to just plain `return NodeList(a, b);`, while keeping the first line, it will compile too.

The reason here is when you return and construct together, it constructs it in-place. But if you put it in a local variable first, it needs to copy it to the return value.

Removing the first line just lets the compiler optimize out the local variable, reducing it to the in-place one again.

But explicitly returning and constructing together works in either case.

Thanks your for the very quick and good explain.

I thinks the DMD should report a more helpful error about this.

Reply via email to