https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97720
--- Comment #3 from m101010a at gmail dot com ---
After looking into this more, I have confirmed that this is definitely the
cause of bug 97339, and found a simpler reproduction in bug 55918 comment #4:
#include <iostream>
class Foo
{
public:
Foo() { std::cout << "Foo::Foo()\n"; }
~Foo() { std::cout << "Foo::~Foo()\n"; }
};
void bad_guy() noexcept {
try {
Foo foo;
throw 0;
} catch (float) {
// Don't catch int.
}
}
void level1() {
bad_guy();
throw "dead code";
}
int main() {
try {
level1();
} catch (int) {
}
}