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

2023-02-07


1018. Ambiguity between simple-declaration and attribute-declaration

Section: 9.1  [dcl.pre]     Status: C++11     Submitter: Mike Miller     Date: 2010-01-04

[Voted into the WP at the March, 2011 meeting as part of paper N3262.]

The grammar for declarations includes the following two nonterminals:

An attribute-specifier followed by a semicolon could thus be parsed as either an attribute-declaration or as a simple-declaration that omits the optional decl-specifier-seq and init-declarator-list, and the current wording does not disambiguate the two. (There doesn't seem to be a compelling need for attribute-declaration as a separate nonterminal, given that simple-declaration can accommodate that form.)

Proposed resolution (February, 2011) [SUPERSEDED]:

Change 9.1 [dcl.pre] paragraph 1 as follows:

...The optional attribute-specifier-seq in a simple-declaration appertains to each of the entities declared by the declarators; it shall not appear if the optional of the init-declarator-list is omitted...