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

2024-04-18


227. How many scopes in an if statement?

Section: 8.5  [stmt.select]     Status: TC1     Submitter: Marc Paterno     Date: 21 Apr 2000

The wording of 8.5 [stmt.select] paragraph 1 is misleading. Instead of

The substatement in a selection-statement (both substatements, in the else form of the if statement) implicitly defines a local scope (6.4 [basic.scope]).

it should say

... each substatement, in the else form...

As is, one is left with the impression that both "then" and "else" clauses together form a single scope.

Proposed resolution (10/00): As suggested.