From my example program, it looks like it does call the destructors in both the cases. At what point does it call the destructors for global and class-static variables since they should be allocated in the data section of the program stack?
Share
From § 3.6.3 of the C++03 standard:
Furthermore, § 9.4.2 7 states:
However, if a destructor has no observable behavior, it may not be invoked. Terry Mahaffey details this in his answer to “Is a C++ destructor guaranteed not to be called until the end of the block?” .