C++ Logo


Advanced search

Substatements of consteval if statements (fixed)

From: Geng Cheng <xmcgcg_at_[hidden]>
Date: Fri, 22 Jul 2022 13:28:20 +0000
N4910 [stmt.pre] paragraph 2 states:
> A substatement of a statement is one of the following:
> ...
> for a selection-statement, any of its statements (but not its init-statement), or¡­

Consteval if statements have the following syntaxes:
if consteval compound-statement
if consteval compound-statement else statement

The syntaxes use compound-statement as the if-block instead of statement, while the semantic implies that compound-statement should be treated as a substatement (N4910 [stmt.if] paragraph 5):
> If a consteval if statement is evaluated in a context that is manifestly constant-evaluated, the first substatement is executed.
¡®The first substatement¡¯ can only refer to compound-statement.

Does the definition of substatement exclude compound-statement appearing in the syntaxes from being substatements? If so, this is clearly a defect.

P.S. It seems that the format of my last email is broken, hope it is OK this time.

Received on 2022-07-22 13:28:21