-
Notifications
You must be signed in to change notification settings - Fork 771
[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
Conversation
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. |
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 a char*
rather than const 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!
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 comment
The reason will be displayed to describe this comment to others. Learn more.
the function \tcode{std::terminate} is called\iref{except.terminate}. | |
the function \tcode{std::terminate} is invoked\iref{except.terminate}. |
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.
Generally-speaking, we consider "call" to be syntactic (f(a,b)
is a function call) and "invoke" to be semantic (a + b
for an overloaded operator+
invokes a function but doesn't involve a function call). This terminology isn't used consistently everywhere, but it seems like a good idea to use the more-precise terminology in wording we're touching anyway.
I've asked CWG whether they're OK with us addressing this editorially. Let's double-check there are no objections before applying. |
Why hasn't this been merged yet? |
The array/function-to-pointer standard conversions are always applied when initializing pointer types. Thus, we have no need to specify this adjustment manually, outside of stripping top-level cv. Lvalue-to-rvalue conversions are not specified here as to avoid confusion regarding implicit move. Makes it much more consistent with the rest of our wording :)
Additionally, p4 is merged into p3, as the information is pertinent there, and reduces the amount of repetition.
std::terminate()
is also changed tostd::terminate
to be consistent with how we reference calls to library functions throughout the document,Also fixes #3959.