Skip to content

Commit 7fbdb79

Browse files
AlisdairMtkoeppe
authored andcommitted
[except.uncaught] Tidy the specification for uncaught exceptions
Several concurrent fixes. First include the normative wording that 'uncaught_exceptions' returns the number of uncaught exceptions *on the current thread*. This wording is present in the core language. Then move the core wording for when an exception is uncaught directly into the text that talks about caught and uncaught exceptions. In the process, turn the reference to into a note, so that there is only one normative specification. Finally, remove [except.uncaught] as it is now empty.
1 parent 7f00883 commit 7fbdb79

File tree

3 files changed

+25
-19
lines changed

3 files changed

+25
-19
lines changed

source/exceptions.tex

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,26 @@
317317
the selected constructor is odr-used\iref{basic.def.odr} and
318318
the destructor of \tcode{T} is potentially invoked\iref{class.dtor}.
319319

320+
\pnum
321+
\indextext{exception handling!uncaught}%
322+
An exception is considered \defnx{uncaught}{uncaught exception}
323+
after completing the initialization of the exception object
324+
until completing the activation of a handler for the exception\iref{except.handle}.
325+
\begin{note}
326+
As a consequence, an exception is considered uncaught
327+
during any stack unwinding resulting from it being thrown.
328+
\end{note}
329+
330+
\pnum
331+
\indexlibraryglobal{uncaught_exceptions}%
332+
If an exception is rethrown\iref{expr.throw,propagation},
333+
it is considered uncaught from the point of rethrow
334+
until the rethrown exception is caught.
335+
\begin{note}
336+
The function \tcode{std::uncaught_exceptions}\iref{uncaught.exceptions}
337+
returns the number of uncaught exceptions in the current thread.
338+
\end{note}
339+
320340
\pnum
321341
\indextext{exception handling!rethrow}%
322342
\indextext{rethrow|see{exception handling, rethrow}}%
@@ -331,7 +351,7 @@
331351
\indextext{exception handling!terminate called@\tcode{terminate} called}%
332352
\indextext{\idxcode{terminate}!called}%
333353
If the exception handling mechanism
334-
handling an uncaught exception\iref{except.uncaught}
354+
handling an uncaught exception
335355
directly invokes a function that exits via an
336356
exception, the function \tcode{std::terminate} is invoked\iref{except.terminate}.
337357
\begin{example}
@@ -1127,21 +1147,4 @@
11271147
prematurely based on a determination that the unwind process
11281148
will eventually cause an invocation of the function
11291149
\tcode{std::terminate}.
1130-
1131-
\rSec2[except.uncaught]{The \tcode{std::uncaught_exceptions} function}%
1132-
\indexlibraryglobal{uncaught_exceptions}
1133-
1134-
\pnum
1135-
An exception is considered uncaught
1136-
after completing the initialization of the exception object\iref{except.throw}
1137-
until completing the activation of a handler for the exception\iref{except.handle}.
1138-
\begin{note}
1139-
As a consequence, an exception is considered uncaught
1140-
during any stack unwinding resulting from it being thrown.
1141-
\end{note}
1142-
If an exception is rethrown\iref{expr.throw,propagation},
1143-
it is considered uncaught from the point of rethrow
1144-
until the rethrown exception is caught.
1145-
The function \tcode{std::uncaught_exceptions}\iref{uncaught.exceptions}
1146-
returns the number of uncaught exceptions in the current thread.%
11471150
\indextext{exception handling|)}

source/support.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4050,7 +4050,7 @@
40504050
\begin{itemdescr}
40514051
\pnum
40524052
\returns
4053-
The number of uncaught exceptions\iref{except.uncaught}.
4053+
The number of uncaught exceptions\iref{except.throw} in the current thread.
40544054

40554055
\pnum
40564056
\remarks

source/xrefdelta.tex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,9 @@
473473
\movedxref{stoptoken.cons}{stopsource}
474474
\movedxref{stoptoken.nonmembers}{stopsource}
475475

476+
% https://github.com/cplusplus/draft/pull/7276
477+
\movedxref{except.uncaught}{except.throw}
478+
476479
% https://github.com/cplusplus/draft/pull/7345
477480
\movedxref{basic.stc.inherit}{basic.stc.general}
478481

0 commit comments

Comments
 (0)