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#2] incorrectly dropping cv-qualifiers CWG2699 #3959

Closed
JustAnotherHumanBeing opened this issue Apr 27, 2020 · 8 comments · Fixed by #6328
Closed

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

JustAnotherHumanBeing opened this issue Apr 27, 2020 · 8 comments · Fixed by #6328

Comments

@JustAnotherHumanBeing
Copy link

JustAnotherHumanBeing commented Apr 27, 2020

This part of the C++ Standard says: Evaluating a throw-expression with an operand throws an exception; the type of the exception object is determined by removing any top-level cv-qualifiers from the static type of the operand and adjusting the type from “array of T” or function type T to “pointer to T” .
One might think that this passage implies that if we are dealing with the operand of type const char[3] , the const qualifier will be removed from it and then char[3] will be adjusted to type char* .

@sdkrystian
Copy link
Contributor

This will be resolved by #3921

@jensmaurer jensmaurer changed the title [expr.throw#2] [expr.throw#2] incorrectly dropping cv-qualifiers Apr 29, 2020
@JustAnotherHumanBeing
Copy link
Author

According to #3921, "any top-level cv-qualifiers from the type of the (possibly-converted) operand" will be removed. But if they are prvalues, object pointers and function pointers can't have top-level cv-qualifiers.

@sdkrystian
Copy link
Contributor

Yes, no cv-qualifiers would be removed in such cases as there are none to remove. Is that problematic?

@JustAnotherHumanBeing
Copy link
Author

Well, that part of the sentence is ambiguously written because it assumes that a reader knows that such prvalues can't have a top-level const.

@sdkrystian
Copy link
Contributor

The end result would still be the same?

@JustAnotherHumanBeing
Copy link
Author

Okay.

@jensmaurer jensmaurer changed the title [expr.throw#2] incorrectly dropping cv-qualifiers [expr.throw#2] incorrectly dropping cv-qualifiers CWG2699 Feb 18, 2023
@jensmaurer
Copy link
Member

CWG2699

@frederick-vs-ja
Copy link
Contributor

This should have been fixed by #6328 (3588b7d).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants