Created on 2023-08-31.00:00:00 last changed 7 months ago
Proposed resolution (approved by CWG 2023-09-15):
If a declaration that is not a name-independent declaration andwhose target scope isthat binds a name in the block scope S of apotentially conflicts with a declaration whose target scope is the parent scope of S, the program is ill-formed.
- 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
[Accepted as a DR at the November, 2023 meeting.]
Consider:
void f(int i) { extern int i; }
According to 6.4.3 [basic.scope.block] paragraph 2, the target scope of the declaration is relevant (which would be the global scope), but not the scope in which the name is bound. That seems wrong. For comparison, template parameter names use the latter rule (13.8.2 [temp.local] paragraph 6).
History | |||
---|---|---|---|
Date | User | Action | Args |
2024-04-05 21:43:46 | admin | set | status: dr -> drwp |
2023-12-19 10:15:28 | admin | set | status: ready -> dr |
2023-09-15 21:51:11 | admin | set | status: open -> ready |
2023-09-02 07:30:49 | admin | set | messages: + msg7420 |
2023-08-31 00:00:00 | admin | create |