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.