This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 116c. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2025-03-14


3008. Missing Annex C entry for void object declarations

Section: C.7.6  [diff.dcl]     Status: open     Submitter: Jiang An     Date: 2025-03-13

(From submission #682.)

C allows

  extern void x;

C++ does not, as clarified by issue 2475 in 9.1 [dcl.pre] paragraph 8.

This deviation warrants an entry in Annex C.

Possible resolution:

Add a new paragraph to C.7.6 [diff.dcl] as follows:

Affected subclause: 9.1 [dcl.pre]
Change: In C++, no declaration of a variable can have void type. In C, this is allowed, unless the declaration is a definition.
[Example:

  extern void x;   // valid C, invalid in C++
-- end example]
Rationale: Stricter type checking in C++.
Effect on original feature: Deletion of semantically well-defined feature.
Difficulty of converting: Syntactic transformation.
How widely used: Seldom.