Created on 2020-04-06.00:00:00 last changed 11 months ago
Proposed resolution (approved by CWG 2023-03-03):
Change in 7.6.18 [expr.throw] paragraph 2 through 4 as follows:
Evaluating aA throw-expression with an operand throws an exception (14.2 [except.throw]); the. The array-to-pointer (7.3.3 [conv.array]) and function-to-pointer (7.3.4 [conv.func]) standard conversions are performed on the operand. The type of the exception object is determined by removing any top-level cv-qualifiers from thestatictype of the (possibly converted) operandand adjusting the type from “array of T” or function type T to “pointer to T”.A throw-expression with no operand rethrows the currently handled exception (14.4 [except.handle]). If no exception is presently being handled, the function std:: terminate is invoked (14.6.2 [except.terminate]).
TheOtherwise, the exception is reactivated with the existing exception object; no new exception object is created. The exception is no longer considered to be caught.
If no exception is presently being handled, evaluating a throw-expression with no operand calls std:: terminate() (14.6.2 [except.terminate]).
[Accepted as a DR at the June, 2023 meeting.]
Subclause 7.6.18 [expr.throw] paragraph 2 and 3 specify:
Evaluating a throw-expression with an operand throws an exception (14.2 [except.throw]); the type of the exception object is determined by removing any top-level cv-qualifier s from the static type of the operand and adjusting the type from “array of T” or function type T to “pointer to T”.
A throw-expression with no operand rethrows the currently handled exception (14.4 [except.handle]). The exception is reactivated with the existing exception object; no new exception object is created. The exception is no longer considered to be caught.
This means that throwing a value of type const char[3] would throw a char* rather than const char*, which is not intended.
History | |||
---|---|---|---|
Date | User | Action | Args |
2023-12-19 10:15:28 | admin | set | status: dr -> drwp |
2023-07-16 13:00:43 | admin | set | status: ready -> dr |
2023-03-03 21:02:53 | admin | set | messages: + msg7217 |
2023-03-03 21:02:53 | admin | set | status: open -> ready |
2020-04-06 00:00:00 | admin | create |