[Issue 22498] auto ref function with auto ref parameter causes noncopyable payload be cleaned twice

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Nov 12 14:17:25 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=22498

Sebastiaan Koppe <mail at skoppe.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mail at skoppe.eu

--- Comment #2 from Sebastiaan Koppe <mail at skoppe.eu> ---
As have I commented on the newsgroup
https://forum.dlang.org/post/zckdpsukzafedikiuaci@forum.dlang.org

"
It doesn't copy. It just destructs the same object twice... Ouch.

Change the destructor to ~this() { printf("~this(%d)\n", n); n = 12; } and
you'll see.
"

--


More information about the Digitalmars-d-bugs mailing list