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

2024-12-06


2344. Redeclaration of names in init-statements

Section: 8.5  [stmt.select]     Status: NAD     Submitter: John Spicer     Date: 2017-04-19

According to Clause 8 [stmt.stmt] paragraph 3,

A name introduced by a declaration in a condition (either introduced by the decl-specifier-seq or the declarator of the condition) is in scope from its point of declaration until the end of the substatements controlled by the condition. If the name is redeclared in the outermost block of a substatement controlled by the condition, the declaration that redeclares the name is ill-formed.

Should there be a similar rule about redeclaring names introduced by init-statements?

Notes from the April, 2018 teleconference:

CWG agreed that such a rule should be added.

Rationale (January, 2019):

The init-statement case is covered by 6.4.3 [basic.scope.block] paragraph 3. These two references should be harmonized and cross-referenced appropriately as an editorial change.