https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103711
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Without the library dependency, and without the defaulted destructor (since GCC
int constructions = 0;
int destructions = 0;
struct A
{
A()
{
constructions++;
}
virtual ~A() {
destructions++;
}
};
struct B : public virtual A
{
B(int)
{
};
B() : B(1)
{
throw -1;
}
virtual ~B() = default;
};
struct C : public B
{
};
int main() {
try
{
C c;
}
catch (int)
{
}
if (constructions != destructions)
throw 1;
return 0;
}