Skip to content

Commit c7dc821

Browse files
committed
[except.handle] group all paragraphs on searching for handler
This commit moves all of the paragraphs involved in the search for a handler for an exception into a single logical sequence. After this change, [except.spec] deals only with specifying the 'noexcept' function decorator and its interaction with the 'noexcept' operator, and contains no text regarding exceptions themselves. It might be appropriate to move that subclause into the [dcl] structure at a future date.
1 parent fb34daf commit c7dc821

File tree

1 file changed

+34
-35
lines changed

1 file changed

+34
-35
lines changed

source/exceptions.tex

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,40 @@
615615
handler continues in a dynamically surrounding try block
616616
of the same thread.
617617

618+
\pnum
619+
\indextext{exception handling!terminate called@\tcode{terminate} called}%
620+
\indextext{\idxcode{terminate}!called}%
621+
If the search for a handler
622+
encounters the outermost block of a function with a
623+
non-throwing exception specification,
624+
the function \tcode{std::terminate}\iref{except.terminate} is invoked.
625+
\begin{note}
626+
An implementation is not permitted to reject an expression merely because, when
627+
executed, it throws or might
628+
throw an exception from a function with a non-throwing exception specification.
629+
\end{note}
630+
\begin{example}
631+
\begin{codeblock}
632+
extern void f(); // potentially-throwing
633+
634+
void g() noexcept {
635+
f(); // valid, even if \tcode{f} throws
636+
throw 42; // valid, effectively a call to \tcode{std::terminate}
637+
}
638+
\end{codeblock}
639+
The call to
640+
\tcode{f}
641+
is well-formed despite the possibility for it to throw an exception.
642+
\end{example}
643+
644+
\pnum
645+
If no matching handler is found,
646+
the function \tcode{std::terminate} is invoked;
647+
whether or not the stack is unwound before this invocation of
648+
\tcode{std::terminate}
649+
is \impldef{stack unwinding before invocation of
650+
\tcode{std::terminate}}\iref{except.terminate}.
651+
618652
\pnum
619653
A handler is considered \defnx{active}{exception handling!handler!active} when
620654
initialization is complete for the parameter (if any) of the catch clause.
@@ -632,14 +666,6 @@
632666
still active is called the
633667
\defnx{currently handled exception}{exception handling!currently handled exception}.
634668

635-
\pnum
636-
If no matching handler is found,
637-
the function \tcode{std::terminate} is invoked;
638-
whether or not the stack is unwound before this invocation of
639-
\tcode{std::terminate}
640-
is \impldef{stack unwinding before invocation of
641-
\tcode{std::terminate}}\iref{except.terminate}.
642-
643669
\pnum
644670
Referring to any non-static member or base class of an object
645671
in the handler for a
@@ -804,33 +830,6 @@
804830
has a non-throwing exception specification.
805831
\end{example}
806832

807-
\pnum
808-
\indextext{exception handling!terminate called@\tcode{terminate} called}%
809-
\indextext{\idxcode{terminate}!called}%
810-
Whenever an exception is thrown
811-
and the search for a handler\iref{except.handle}
812-
encounters the outermost block of a function with a
813-
non-throwing exception specification,
814-
the function \tcode{std::terminate} is invoked\iref{except.terminate}.
815-
\begin{note}
816-
An implementation is not permitted to reject an expression merely because, when
817-
executed, it throws or might
818-
throw an exception from a function with a non-throwing exception specification.
819-
\end{note}
820-
\begin{example}
821-
\begin{codeblock}
822-
extern void f(); // potentially-throwing
823-
824-
void g() noexcept {
825-
f(); // valid, even if \tcode{f} throws
826-
throw 42; // valid, effectively a call to \tcode{std::terminate}
827-
}
828-
\end{codeblock}
829-
The call to
830-
\tcode{f}
831-
is well-formed despite the possibility for it to throw an exception.
832-
\end{example}
833-
834833
\pnum
835834
An expression $E$ is
836835
\defnx{potentially-throwing}{potentially-throwing!expression} if

0 commit comments

Comments
 (0)