[Bug c++/67773] destructor called on temp object before and named object after move, while not being called on named object before move

awenocur at aol dot com gcc-bugzilla@gcc.gnu.org
Wed Sep 30 11:43:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67773

--- Comment #5 from Adam Wenocur <awenocur at aol dot com> ---
(In reply to Jonathan Wakely from comment #3)
> Oh, are you expecting this:
> 
>   a_thing = demo(demo::second);
> 
> to have the same behaviour as this:
> 
>   a_thing.~demo();
>   new(&a_thing) demo(demo::second);
> 
> ?
> 
> That's not how C++ works.

I don't expect the same behavior, however I expect the same end result:

for the destructor to be called on to be called on the named variable before
the move, then for it to be called on the temporary object.



More information about the Gcc-bugs mailing list