c++11 - noexcept(expression) - where expression is a noexcept function that actually throws -
looking @ c++11 spec (n3485) section 5.3.7, note 3 says result of noexcept(expr) false if:
... potentially-evaluated call function... not have non-throwing exception-speciļ¬cation ... potentially-evaluated throw-expression ... potentially-evaluated dynamic_cast ... potentially-evaluated typeid expression...
does "potentially evaluated" mean drills down (not @ all? little?) determine if 1 of conditions can result in false?
i'm finding (in test code, not application) function claims noexcept does, in fact, throw (even if in cases) still considered noexcept. misunderstanding spec or code in following example wrong?
double calculate(....) noexcept { throw "haha"; } // using simpsons::nelson bool does_not_throw = noexcept(calculate());
according clang 3.3 test says calculate() not throw.
all it's doing checking expression see if terms of expression throw exception. doesn't check actual code potentially called. if 1 of expression terms function call not explicitly noexcept
, assumed able throw exceptions.
or, put way, checks see if of functions being called in expression noexcept
. that's all.
according clang 3.3 test says calculate() not throw.
and that's true. because calculate
defined noexcept
, if tries emit exception, std::terminate
called. therefore, no exceptions emitted function.
Comments
Post a Comment