Created on 2024-06-04.00:00:00 last changed 6 days ago
CWG 2024-09-27
The suggested resolution is circular with the rules in 7.7 [expr.const] paragraph 6.
Possible resolution:
Change in 9.12.3 [dcl.attr.assume] paragraph 1 as follows:
... The expression is not evaluated. If the converted expression would evaluate to true at the point where the assumption appears, the assumption has no effect. Otherwise, outside of an evaluation to determine whether an expression is a core constant expression (7.7 [expr.const]), the behavior is undefined.
Change in 9.12.11 [dcl.attr.noreturn] paragraph 2 as follows:
If a function f is called where f was previously declared with the noreturn attribute, the function call is evaluated outside of an evaluation to determine whether an expression is a core constant expression (7.7 [expr.const]), and f eventually returns, the behavior is undefined.
CWG 2024-09-13
Admitting unbounded core-language undefined behavior in constant expressions is to be avoided. The quoted note is correct; the semantics of [[noreturn]] and [[assume]] need to be clarified.
Possible resolution [SUPERSEDED]:
Change in 9.12.3 [dcl.attr.assume] paragraph 1 as follows:
... The expression is not evaluated. If the converted expression would evaluate to true at the point where the assumption appears or if the assumption is evaluated in a context that is manifestly constant-evaluated, the assumption has no effect. Otherwise, the behavior is undefined.
Change in 9.12.11 [dcl.attr.noreturn] paragraph 2 as follows:
If a function f is called where f was previously declared with the noreturn attribute, the function call is evaluated in a context that is not manifestly constant-evaluated (7.7 [expr.const]), and f eventually returns, the behavior is undefined.
Suggested resolution [SUPERSEDED]:
Change in 3.63 [defns.undefined] as follows:
[Note 1 to entry: ... Evaluation of a constant expression (7.7 [expr.const]) never exhibits behavior explicitly specified as undefined in Clause 4 [intro] through Clause 15 [cpp], excluding 9.12 [dcl.attr]. —end note]
(From editorial issue #7042 and submission #595.)
Subclause 3.63 [defns.undefined] states:
[Note 1 to entry: ... Evaluation of a constant expression (7.7 [expr.const]) never exhibits behavior explicitly specified as undefined in Clause 4 [intro] through Clause 15 [cpp]. —end note]
However, 7.7 [expr.const] bullet 5.8 excludes [[noreturn]] and [[assume]]; see also 7.7 [expr.const] paragraph 6.
History | |||
---|---|---|---|
Date | User | Action | Args |
2024-09-27 21:20:46 | admin | set | messages: + msg7826 |
2024-09-25 17:32:08 | admin | set | messages: + msg7820 |
2024-09-25 17:32:08 | admin | set | status: open -> review |
2024-08-13 21:17:59 | admin | set | messages: + msg7790 |
2024-06-04 00:00:00 | admin | create |