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

2024-10-26


2071. typedef with no declarator

Section: 9.2.4  [dcl.typedef]     Status: CD4     Submitter: Richard Smith     Date: 2014-01-16

[Adopted at the February, 2016 meeting.]

There should be a rule to prohibit the almost certainly erroneous declaration

  typedef struct X { };    // Missing declarator

Proposed resolution (September, 2015):

Change 9.2.4 [dcl.typedef] paragraph 1 as follows:

Declarations containing the decl-specifier typedef declare identifiers that can be used later for naming fundamental (6.8.2 [basic.fundamental]) or compound (6.8.4 [basic.compound]) types. The typedef specifier shall not be combined in a decl-specifier-seq with any other kind of specifier except a type-specifier, and it shall not be used in the decl-specifier-seq of a parameter-declaration (9.3.4.6 [dcl.fct]) nor in the decl-specifier-seq of a function-definition (9.5 [dcl.fct.def]). If a typedef specifier appears in a declaration without a declarator, the program is ill-formed.