Consider the following program.
struct s { ~s(); };
void f()
{
static s a;
}
struct t { ~t() { f(); } };
int main()
{
static s b;
static t c;
}
I'm trying to figure out what exactly the standard guarantees with respect to the destruction of static objects, but I'm finding the text of C++03[basic.start.term] rather insufficient.
Is the behavior of the program defined? If so, what is the order of destruction of the static objects a, b and c? What would happen if s::~s threw an exception? Please explain your reasoning, preferably with quotes from the standard.