This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-11-11
[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?
Notes from the December, 2020 teleconference:
Such declarations are permitted in C, so this question was referred to the C liaison for investigation.
CWG 2022-11-11
CWG resolved to making such declarations ill-formed.
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 ]