Title
Object declarations of type cv void
Status
tentatively ready
Section
6.8.2 [basic.fundamental]
Submitter
Krystian Stasiowski

Created on 2020-04-22.00:00:00 last changed 4 days ago

Messages

Date: 2022-12-02.23:21:56

Proposed resolution (approved by CWG 2022-12-02):

Change in 9.1 [dcl.pre] paragraph 7 as follows:

If the decl-specifier-seq contains the typedef specifier, the declaration is called a 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 is called a function declaration if 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 called an object declaration otherwise. 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 ]

Date: 2022-12-02.23:21:56

CWG 2022-11-11

CWG resolved to making such declarations ill-formed.

Date: 2020-12-15.00:00:00

Notes from the December, 2020 teleconference:

Such declarations are permitted in C, so this question was referred to the C liaison for investigation.

Date: 2020-04-22.00:00:00

(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
2022-12-02 23:21:56adminsetmessages: + msg7074
2022-12-02 23:21:56adminsetstatus: drafting -> tentatively ready
2022-11-20 07:54:16adminsetmessages: + msg7041
2022-11-20 07:54:16adminsetstatus: review -> drafting
2022-11-11 09:36:07adminsetstatus: open -> review
2021-02-17 00:00:00adminsetmessages: + msg6493
2020-04-22 00:00:00admincreate