Title
Misleading disambiguation rule for nested if
Status
open
Section
8.5.2 [stmt.if]
Submitter
Brian Bi

Created on 2026-07-15.00:00:00 last changed 5 days ago

Messages

Date: 2026-07-18.21:29:39

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: ... ]
Date: 2026-07-15.00:00:00

(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: ... ]
History
Date User Action Args
2026-07-18 21:29:39adminsetmessages: + msg8631
2026-07-15 00:00:00admincreate