Created on 2026-02-27.00:00:00 last changed 3 weeks ago
Proposed resolution (approved by CWG 2026-05-08):
Add before 9.3.1 [dcl.decl.general] paragraph 4 and change paragraphs 4 and 5 as follows:
The initializer of an init-declarator shall not be present unless the declarator declares a variable and the host scope (6.4.1 [basic.scope.scope]) of the declaration is the same as its target scope.
The optional requires-clauseinof an init-declarator or member-declarator shall not be presentonly ifunless the declarator declares a templated function (13.1 [temp.pre]). ...
The optional function-contract-specifier-seq (9.4.1 [dcl.contract.func])inof an init-declarator shall not be presentonly ifunless the declarator declares a function.
Remove 9.5.1 [dcl.init.general] paragraph 5 as follows:
A declaration D of a variable with linkage shall not have an initializer if D inhabits a block scope.
(From submission #856.)
Consider:
typedef int x = 0;
There is no prohibition against this.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2026-05-08 21:09:36 | admin | set | status: open -> tentatively ready |
| 2026-03-12 20:38:36 | admin | set | messages: + msg8511 |
| 2026-02-27 00:00:00 | admin | create | |