I am a little bit confused with destructors and noexcept
. My understanding was that in C++11 any destructor, including user-defined, is implicitly noexcept(true)
, even if we throw
from it. And one has to specify explicitly noexcept(false)
if they want it to be that way for some reason.
I'm seeing quite the opposite - with GCC 4.7.2, the user-defined destructor, no matter how primitive the class and destructor are, is implicitly noexcept(false)
. What am I missing here? Is there some hidden gotcha with user-defined destructors?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…