This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 120b. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2026-07-26


3212. Misleading disambiguation rule for nested if

Section: 8.5.2  [stmt.if]     Status: open     Submitter: Brian Bi     Date: 2026-07-15

(From submission #947.)

The last sentence in 8.5.2 [stmt.if] paragraph 1 is phrased as a semantic constraint, but is intended as a grammatical disambiguation rule:

... In the second form of if statement (the one including else), if the first substatement is also an if statement then that inner if statement shall contain an else part. [Footnote: ... ]

Suggested resolution:

Change in 8.5.2 [stmt.if] paragraph 1 as follows:

... In the second form of if statement (the one including else), if the first substatement is also an if statement then that inner if statement shall contain an else part A selection-statement is never interpreted as an if statement having two substatements if the first such substatement would be an if statement having only one substatement. [Footnote: ... ]