cplusplus / draft

C++ standards drafts
http://www.open-std.org/jtc1/sc22/wg21/
5.7k stars 751 forks source link

Non-defining object declarations can have type cv void CWG2475 #3953

Open sdkrystian opened 4 years ago

sdkrystian commented 4 years ago

Nothing prohibits an object declaration from having type cv void. While there is wording that prevents an object definition from having such a type in [basic.def], so such wording exists to cover the following:

extern void var; // not a definition, so incomplete type is permitted
jensmaurer commented 4 years ago

While pretty obvious, this does not feel editorial to me.

[dcl.pre] p10 introduces "object declaration" (which, curiously enough, might also declare a reference). This would be a suitable place to prohibit "cv void".

jensmaurer commented 3 years ago

CWG 2020-12-07: C allows extern void var; A new core issue will be created, and deferred to the WG14/WG21 liaison group.

jensmaurer commented 3 years ago

[basic.pre] p6

A variable is introduced by the declaration of a reference other than a non-static data member or of an object. The variable’s name, if any, denotes the reference or object.

Presumably, an "object" must have object type.

jensmaurer commented 2 years ago

See CWG2475

frederick-vs-ja commented 1 year ago

Should have been resolved by #6118 (https://github.com/cplusplus/draft/pull/6118/commits/4682d959dff605c86b6ad361acccf839d2f0ccd2).