Open
Description
Each
- selection or iteration statement ([stmt.select], [stmt.iter]),
- substatement of such a statement,
- handler ([except.pre]), or
- compound statement ([stmt.block]) that is not the compound-statement of a handler
introduces a block scope that includes that statement or handler.
[Note 1: A substatement that is also a block has only one scope. — end note]
Isn't that note should be phrased as a normative rule? My proposal is that
Each
- [...]
- substatement of such a statement that is not a compound-statement,
- [...]
- compound statement ([stmt.block]) that is not the compound-statement of a handler
introduces a block scope that includes that statement or handler.
[Note 1: A substatement that is also a block has only one scope. — end note].
if(true) {
}
The substatement is a compound-statement, hence the second bullet does not apply but the last bullet does, which means the substatement only introduced one block scope.
Metadata
Metadata
Assignees
Labels
No labels