[Bug c++/103843] Direct call to Desctructor is optimized out
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Dec 27 16:38:03 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103843
--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Also, this is an automatic (i.e. stack) variable, so the destructor will run at
the end of the block, meaning it will be settled twice. So another form of
undefined behaviour. The program is just broken, in multiple ways. You cannot
expect sensible behaviour from garbage code.
More information about the Gcc-bugs
mailing list