https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86769
--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Further poking revealed that the patch above mishandles
// PR c++/86769
// { dg-do run }
#define assert(X) do { if (!(X)) __builtin_abort(); } while(0)
int g;
struct X {
X() { g++; }
~X() { g--; }
operator bool() { return g == 0; }
};
void
check_live ()
{
assert (g > 0);
}
void
check_dead ()
{
assert (g == 0);
}
void f(X &) { assert (!g); }
int
main ()
{
for (int i = 0; i < 1; ++i, check_dead ())
{
X x = X();
check_live ();
}
}
So saving it here lest I lose it.