On Friday, 13 October 2017 at 10:35:56 UTC, Jack Applegame wrote:
Compiler creates struct on the stack and silently (without postblitting and destruction old object) moves it to another address. Is it normal? I don't think so.

It is. Structs have no identity, and the compiler/GC/whatever is free to copy and/or move them about as it sees fit (as long as there is ostensibly only one - no duplicate constructor/destructor calls, no desynching of state). That's why the documentation[1] says not to have internal pointers in structs.

WAT??? Compiler creates struct on the stack copies it without postblitting and destructs both objects.

Now this looks like a real bug. There should be a this(this) call in there.

Can I donate to the D Foundation and that my donations would be aimed at fixing exactly these bugs?

BountySource[2] lets you do basically exactly that.

[1]: https://dlang.org/spec/garbage.html, "Do not have pointers in a struct instance that point back to the same instance."

[2]: https://www.bountysource.com/

Reply via email to