Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[except.handle] group all paragraphs on searching for a handler #7283

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 34 additions & 35 deletions source/exceptions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,40 @@
handler continues in a dynamically surrounding try block
of the same thread.

\pnum
\indextext{exception handling!terminate called@\tcode{terminate} called}%
\indextext{\idxcode{terminate}!called}%
If the search for a handler
encounters the outermost block of a function with a
non-throwing exception specification,
the function \tcode{std::terminate}\iref{except.terminate} is invoked.
\begin{note}
An implementation is not permitted to reject an expression merely because, when
executed, it throws or might
throw an exception from a function with a non-throwing exception specification.
\end{note}
\begin{example}
\begin{codeblock}
extern void f(); // potentially-throwing

void g() noexcept {
f(); // valid, even if \tcode{f} throws
throw 42; // valid, effectively a call to \tcode{std::terminate}
}
\end{codeblock}
The call to
\tcode{f}
is well-formed despite the possibility for it to throw an exception.
\end{example}

\pnum
If no matching handler is found,
the function \tcode{std::terminate} is invoked;
whether or not the stack is unwound before this invocation of
\tcode{std::terminate}
is \impldef{stack unwinding before invocation of
\tcode{std::terminate}}\iref{except.terminate}.

\pnum
A handler is considered \defnx{active}{exception handling!handler!active} when
initialization is complete for the parameter (if any) of the catch clause.
Expand All @@ -635,14 +669,6 @@
still active is called the
\defnx{currently handled exception}{exception handling!currently handled exception}.

\pnum
If no matching handler is found,
the function \tcode{std::terminate} is invoked;
whether or not the stack is unwound before this invocation of
\tcode{std::terminate}
is \impldef{stack unwinding before invocation of
\tcode{std::terminate}}\iref{except.terminate}.

\pnum
Referring to any non-static member or base class of an object
in the handler for a
Expand Down Expand Up @@ -807,33 +833,6 @@
has a non-throwing exception specification.
\end{example}

\pnum
\indextext{exception handling!terminate called@\tcode{terminate} called}%
\indextext{\idxcode{terminate}!called}%
Whenever an exception is thrown
and the search for a handler\iref{except.handle}
encounters the outermost block of a function with a
non-throwing exception specification,
the function \tcode{std::terminate} is invoked\iref{except.terminate}.
\begin{note}
An implementation is not permitted to reject an expression merely because, when
executed, it throws or might
throw an exception from a function with a non-throwing exception specification.
\end{note}
\begin{example}
\begin{codeblock}
extern void f(); // potentially-throwing

void g() noexcept {
f(); // valid, even if \tcode{f} throws
throw 42; // valid, effectively a call to \tcode{std::terminate}
}
\end{codeblock}
The call to
\tcode{f}
is well-formed despite the possibility for it to throw an exception.
\end{example}

\pnum
An expression $E$ is
\defnx{potentially-throwing}{potentially-throwing!expression} if
Expand Down
Loading