Do anyone of you encountered this? Or can you point to any potential
mistake for which this can happen?
Is there any gcc flag that may help in this issue
One thought.
After an exception is thrown the stack is unwound.
During the unwinding the destructor of all stack objects is called.
If one of the destructors of these objects also throws an exception
then the application will terminate.
struct X
{
~X() {throw int(5);}
};
int main()
{
try
{
X a;
throw int(6);
}
catch(int e)
{
std::cout << "Cought\n"; // Never gets here.
}
std::cout << "Done\n";
}