Hi
I have one question about failed constructor and failed destructor in C++.
I noticed that when the constructor failed, an exception will be thrown. But there is no exception thrown in destructor.
My question is
1) If constructor failed, what exception will be thrown? bad_alloc? or anything else related? Under what situation, a constructor would fail? What about the successfully constructed part?
2) Under what situation, a destructor would fail? If no exception is thrown, what would happen to the destructor? How does the compiler deal with it? What's the return value to the function it is called?
Thanks!
Any comments are strongly appreciated!