In P0012R1, \"Make exception specifications be part of the type system\",
I see that noexcept
is now becoming a part of the function type.
I
noexcept(true)
functions can call noexcept(false)
functions. There will be a runtime error if an exception is thrown. The canonical example of why this is allowed is:
double hypotenuse(double opposite, double adjacent) noexcept(true)
{
return std::sqrt(opposite*opposite + adjacent*adjacent);
}
std::sqrt
will throw domain_error
if its argument is negative, but clearly that will never happen here.
(In an ideal world, it would be forbidden by default with an exception_cast
to allow it where required. The result could either be UB if an exception is thrown, or std::terminate).