Re:Catching use-after-move C++ bugs with Clang's consumed an...
by ori_b on Wednesday July 10, 2019 @02:15PM
(#20404700)
The destructor gets called on them. They need to be valid enough for that.
[ Parent
| on HN ]
Re:Catching use-after-move C++ bugs with Clang's consumed an...
by foota on Wednesday July 10, 2019 @05:09PM
(#20406578)
Hm, technically don't think this would be required. Take for instance:
auto no_destroy = new MoveNoDestroy();
MoveNoDestroy* moved_into;
*moved_into = std::move(*no_destroy);
Wouldn't call the destructor of the moved from MoveNoDestroy.
Re:Catching use-after-move C++ bugs with Clang's consumed an...
by 0xffff2 on Wednesday July 10, 2019 @06:51PM
(#20407410)
Yes, if you leak resources, their destructors won't be called. That really has nothing at all to do with move semantics though. I think the important point is that move semantics don't alter the lifetime management of the moved-from object.