Created on 2020-04-22.00:00:00 last changed 16 months ago
Proposed resolution (approved by CWG 2022-12-02; amended 2023-02-06):
Change in 9.1 [dcl.pre] paragraph 7 as follows:
If the decl-specifier-seq contains the typedef specifier, the declaration iscalleda typedef declaration and each declarator-id is declared to be a typedef-name, synonymous with its associated type (9.2.4 [dcl.typedef]). [ Note 4: Such a declarator-id is an identifier (11.4.8.3 [class.conv.fct]). —end note]If the decl-specifier-seq contains no typedef specifier,Otherwise, if the type associated with a declarator-id is a function type (9.3.4.6 [dcl.fct]), the declaration iscalleda function declarationif the type associated with a declarator-id is a function type (9.3.4.6 [dcl.fct]) and. Otherwise, if the type associated with a declarator-id is an object or reference type, the declaration is an object declarationotherwise. Otherwise, the program is ill-formed.[ Example:
int f(), x; // OK, function declaration for f and object declaration for x extern void g(), // OK, function declaration for g y; // error: void is not an object type-- end example ]
CWG 2022-11-11
CWG resolved to making such declarations ill-formed.
Notes from the December, 2020 teleconference:
Such declarations are permitted in C, so this question was referred to the C liaison for investigation.
[Accepted as a DR at the February, 2023 meeting.]
(From editorial issue 3953.)
Although an object cannot be defined with a type of cv void, there is nothing preventing a non-defining declaration of an object with that type. Should it be disallowed?
History | |||
---|---|---|---|
Date | User | Action | Args |
2023-07-16 13:00:43 | admin | set | status: open -> c++23 |
2023-07-16 13:00:43 | admin | set | status: dr -> open |
2023-02-18 18:43:04 | admin | set | status: ready -> dr |
2023-02-06 21:43:56 | admin | set | status: tentatively ready -> ready |
2022-12-02 23:21:56 | admin | set | messages: + msg7074 |
2022-12-02 23:21:56 | admin | set | status: drafting -> tentatively ready |
2022-11-20 07:54:16 | admin | set | messages: + msg7041 |
2022-11-20 07:54:16 | admin | set | status: review -> drafting |
2022-11-11 09:36:07 | admin | set | status: open -> review |
2021-02-17 00:00:00 | admin | set | messages: + msg6493 |
2020-04-22 00:00:00 | admin | create |