-
Notifications
You must be signed in to change notification settings - Fork 781
[expr.throw] Make wording for throw-expressions more consistent with [expr] CWG2699 #3921
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -6584,19 +6584,21 @@ | |||||
A \grammarterm{throw-expression} is of type \tcode{void}. | ||||||
|
||||||
\pnum | ||||||
Evaluating a \grammarterm{throw-expression} with an operand throws an | ||||||
exception\iref{except.throw}; the type of the exception object is determined by removing | ||||||
any top-level \grammarterm{cv-qualifier}{s} from the static type of the | ||||||
operand and adjusting the type | ||||||
from ``array of \tcode{T}'' or function type \tcode{T} | ||||||
to ``pointer to \tcode{T}''. | ||||||
A \grammarterm{throw-expression} with an operand throws an exception\iref{except.throw}. | ||||||
The array-to-pointer\iref{conv.array} and function-to-pointer\iref{conv.func} | ||||||
standard conversions are performed on the operand. | ||||||
The type of the exception object\iref{except.throw} is determined by | ||||||
removing any top-level cv-qualifiers from the type of the (possibly-converted) operand. | ||||||
|
||||||
\pnum | ||||||
\indextext{exception handling!rethrow}% | ||||||
A | ||||||
\grammarterm{throw-expression} | ||||||
\indextext{exception handling!terminate called@\tcode{terminate} called}% | ||||||
\indextext{\idxcode{terminate}!called}% | ||||||
A \grammarterm{throw-expression} | ||||||
with no operand rethrows the currently handled exception\iref{except.handle}. | ||||||
The exception is reactivated with the existing exception object; | ||||||
If no exception is currently being handled, | ||||||
the function \tcode{std::terminate} is called\iref{except.terminate}. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Generally-speaking, we consider "call" to be syntactic ( |
||||||
Otherwise, the exception is reactivated with the existing exception object; | ||||||
no new exception object is created. | ||||||
The exception is no longer considered to be caught. | ||||||
\begin{example} | ||||||
|
@@ -6612,16 +6614,6 @@ | |||||
\end{codeblock} | ||||||
\end{example} | ||||||
|
||||||
\pnum | ||||||
\indextext{exception handling!rethrow}% | ||||||
\indextext{exception handling!terminate called@\tcode{terminate} called}% | ||||||
\indextext{\idxcode{terminate}!called}% | ||||||
If no exception is presently being handled, | ||||||
evaluating a | ||||||
\grammarterm{throw-expression} | ||||||
with no operand calls | ||||||
\tcode{std::\brk{}terminate()}\iref{except.terminate}. | ||||||
|
||||||
\rSec2[expr.ass]{Assignment and compound assignment operators}% | ||||||
\indextext{expression!assignment and compound assignment} | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is technically a normative change: previously throwing a
const char[3]
would throw achar*
rather thanconst char*
. But the old wording is sufficiently obviously wrong that that seems OK.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see that's #3959. I even managed to pick exactly the same example!