Wake up Brazil
Wake up Brazil

Reputation: 3411

I believe this to be a (minor) defect in the C++11 Standard

I believe this to be a (minor) defect in the C++11 Standard. In [dcl.dcl] we have:

simple-declaration:

          decl-specifier-seqopt init-declarator-listopt ;

The decl-specifier-seq can't be optional.

For instance the snippet below doesn't compile:

x;

If I'm correct here, then the beginning of paragraph §8.3/1 should also be altered:

From:

A list of declarators appears after an optional (Clause 7) decl-specifier-seq (7.1).

To:

A list of declarators appears after a decl-specifier-seq (7.1).

Upvotes: 7

Views: 393

Answers (1)

user2249683
user2249683

Reputation:

Too long for a comment

In clause 7, paragraph 3:

In a simple-declaration, the optional init-declarator-list can be omitted only when declaring a class (Clause 9) or enumeration (7.2), that is, when the decl-specifier-seq contains either a class-specifier, an elaborated-type-specifier with a class-key (9.1), or an enum-specifier. In these cases and whenever a class-specifier or enum-specifier is present in the decl-specifier-seq, the identifiers in these specifiers are among the names being declared by the declaration (as class-names, enum-names, or enumerators, depending on the syntax). In such cases, and except for the declaration of an unnamed bit-field (9.6), the decl-specifier-seq shall introduce one or more names into the program, or shall redeclare a name introduced by a previous declaration.

And in clause 7, paragraph 9

Only in function declarations for constructors, destructors, and type conversions can the decl-specifier-seq be omitted.

Upvotes: 11

Related Questions