Depends on what you think throw()
.
What the standard actually means is that “add additional code around each call to this function, if necessary, or in the function itself, to ensure that if this function is selected, an exception will be caught and called std::unexpected
".
Some compilers have implemented this to mean “optimizing calls to this function under the assumption that they will not throw”, but (in violation of the standard) did not perform runtime checks.
So, adding it to the destructor (which, of course, should not be thrown) on (but in practice cannot) add a run-time check that should never run and, therefore, can help debug your code. It may or may not include optimization.
source share