Title
Clean up specification of noexcept operator
Status
drwp
Section
7.6.2.7 [expr.unary.noexcept]
Submitter
Jan Schultke

Created on 2023-08-30.00:00:00 last changed 8 months ago

Messages

Date: 2023-10-06.22:55:13

Proposed resolution (approved by CWG 2023-10-06):

Change all of 7.6.2.7 [expr.unary.noexcept] as follows:

The noexcept operator determines whether the evaluation of its operand, which is an unevaluated operand (7.2.3 [expr.context]), can throw an exception (14.2 [except.throw]).

noexcept-expression:
        noexcept ( expression )

The operand of the noexcept operator is an unevaluated operand (7.2.3 [expr.context]). If the operand is a prvalue, the temporary materialization conversion (7.3.5 [conv.rval]) is applied.

The result of the noexcept operator is a prvalue of type bool. The result is false if the full-expression of the operand is potentially-throwing (14.5 [except.spec]), and true otherwise.

[Note 1: A noexcept-expression is an integral constant expression (7.7 [expr.const]). —end note]

If the operand is a prvalue, the temporary materialization conversion (7.3.5 [conv.rval]) is applied. The result of the noexcept operator is true unless the full-expression of the operand is potentially-throwing (14.5 [except.spec]).

Date: 2023-11-15.00:00:00

[Accepted as a DR at the November, 2023 meeting.]

The introductory sentence "can throw an exception" is misleading, because it might be interpreted to cover exceptions thrown as the result of encountering undefined behavior.

History
Date User Action Args
2024-04-05 21:43:46adminsetstatus: dr -> drwp
2023-12-19 10:15:28adminsetstatus: ready -> dr
2023-12-02 15:54:05adminsetstatus: tentatively ready -> ready
2023-10-06 22:55:13adminsetmessages: + msg7450
2023-10-06 22:55:13adminsetstatus: open -> tentatively ready
2023-08-30 00:00:00admincreate