https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103843
--- Comment #8 from Jonathan Wakely ---
(In reply to Jonathan Wakely from comment #7)
> 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.
Sorry, auto-corre
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103843
--- Comment #7 from Jonathan Wakely ---
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, i
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103843
Jakub Jelinek changed:
What|Removed |Added
Resolution|FIXED |INVALID
CC|
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103843
Georgii.Shagov changed:
What|Removed |Added
Resolution|INVALID |FIXED
--- Comment #5 from Georgii.Shag
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103843
Andrew Pinski changed:
What|Removed |Added
Resolution|FIXED |INVALID
--- Comment #4 from Andrew Pins
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103843
Georgii.Shagov changed:
What|Removed |Added
Resolution|INVALID |FIXED
--- Comment #3 from Georgii.Shag
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103843
Andrew Pinski changed:
What|Removed |Added
Resolution|--- |INVALID
Status|UNCONFIRMED
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103843
--- Comment #1 from Georgii.Shagov ---
>From experiments, I would guess that in case of -O3 the call to destructor was
substituted by initializer:
This works fine:
cat ./d.cpp
#include
class S {
public:
S() : i{1} {}
~S() { i=0; }
v