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

Created on 2021-08-26.00:00:00 last changed 28 months 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: 2022-02-15.00:00:00

[Accepted at the February, 2022 meeting.]

The changes of P1787R6 inadvertently made constructs like

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

ill-formed.

History
Date User Action Args
2022-08-19 07:54:33adminsetstatus: accepted -> cd6
2022-02-15 00:00:00adminsetstatus: ready -> accepted
2021-11-15 00:00:00adminsetmessages: + msg6526
2021-08-26 00:00:00admincreate