Title
Unintended declaration conflicts in nested statement scopes
Status
ready
Section
6.4.3 [basic.scope.block]
Submitter
Jens Maurer

Created on 2021-08-26.00:00:00 last changed 1 week ago

Messages

Date: 2021-09-15.00:00:00

Proposed resolution (September, 2021):

Change 6.4.3 [basic.scope.block] bullet 2.2 as follows:

If a declaration whose target scope is the block scope S of a

  • compound-statement of a lambda-expression, function-body, or function-try-block,

  • substatement of a selection or iteration statement that is not itself a selection or iteration statement, or

  • handler of a function-try-block

potentially conflicts with a declaration whose target scope is the parent scope of S, the program is ill-formed.

(See editorial issue 4843.)

Date: 2021-08-26.00:00:00

The changes of P1878R6 inadvertently made constructs like

  if (int a = 1)
    if (int a = 1)
      ...

ill-formed.

History
Date User Action Args
2021-11-15 00:00:00adminsetmessages: + msg6526
2021-08-26 00:00:00admincreate