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

[expr.throw] Make wording for throw-expressions more consistent with [expr] CWG2699 #3921

Closed
wants to merge 1 commit into from

Conversation

sdkrystian
Copy link
Contributor

@sdkrystian sdkrystian commented Apr 6, 2020

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 to std::terminate to be consistent with how we reference calls to library functions throughout the document,

Also fixes #3959.

Comment on lines +6588 to +6591
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.
Copy link
Member

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.

Copy link
Member

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}.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
the function \tcode{std::terminate} is called\iref{except.terminate}.
the function \tcode{std::terminate} is invoked\iref{except.terminate}.

Copy link
Member

@zygoloid zygoloid Oct 18, 2020

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.

@zygoloid zygoloid added the changes requested Changes to the wording or approach have been requested and not yet applied. label Oct 18, 2020
@zygoloid
Copy link
Member

I've asked CWG whether they're OK with us addressing this editorially. Let's double-check there are no objections before applying.

@JustAnotherHumanBeing
Copy link

Why hasn't this been merged yet?

@jensmaurer
Copy link
Member

CWG2699

@jensmaurer jensmaurer changed the title [expr.throw] Make wording for throw-expressions more consistent with [expr] [expr.throw] Make wording for throw-expressions more consistent with [expr] CWG2699 Feb 18, 2023
@wg21bot wg21bot added the needs rebase The pull request needs a git rebase to resolve merge conflicts. label Jul 22, 2023
@frederick-vs-ja
Copy link
Contributor

Superseded by #6328 (3588b7d)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changes requested Changes to the wording or approach have been requested and not yet applied. needs rebase The pull request needs a git rebase to resolve merge conflicts.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[expr.throw#2] incorrectly dropping cv-qualifiers CWG2699
6 participants