C++ Logo

std-proposals

Advanced search

Re: extern noexcept

From: Walt Karas <wkaras_at_[hidden]>
Date: Tue, 24 Sep 2019 14:28:09 +0000 (UTC)
On 2019-09-24 01:06, Walt Karas via Std-Proposals wrote:
>
> (Side question:? shouldn't the Standard require a diagnostic if a
> noexcept function calls noexcept(false) functions on some codepath?)

Andrey Semashev via Std-Proposals wrote:
  No, because that function (1) may not actually throw, (2) may be inside
  a try block or may not be called in runtime and (3) program termination
  in case of an exception may be intended.
But points 1 and 2 contradict the premise of the question. try/catch statements would I suppose be required to have catch (...) in noexcept functions. For point 3, is there really a guarantee this will cause termination? Seems like the exception could still be caught higher in the call stack, and some objects could potentially not get destroyed. It seems better to encourage:
void calls_throwing_stuff() noxecept{ // stuff}
to be changed to something like:
void calls_throwing_stuff() noxecept{ try { // stuff } catch (...) std::terminate();}


Received on 2019-09-24 09:30:46