Title
Ambiguity between simple-declaration and attribute-declaration
Status
c++11
Section
9.1 [dcl.pre]
Submitter
Mike Miller

Created on 2010-01-04.00:00:00 last changed 123 months ago

Messages

Date: 2011-03-15.00:00:00

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

Date: 2011-02-15.00:00:00

Proposed resolution (February, 2011) [SUPERSEDED]:

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

    simple-declaration:
      attribute-specifier-seqopt decl-specifier-seqopt init-declarator-listopt ;
      attribute-specifier-seq decl-specifier-seq init-declarator-list ;
...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...
Date: 2010-08-23.00:00:00

The grammar for declarations includes the following two nonterminals:

    simple-declaration:
      attribute-specifieropt decl-specifier-seqopt init-declarator-listopt ;
    attribute-declaration:
      attribute-specifier ;

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.)

History
Date User Action Args
2014-03-03 00:00:00adminsetstatus: fdis -> c++11
2011-04-10 00:00:00adminsetmessages: + msg3323
2011-04-10 00:00:00adminsetstatus: review -> fdis
2011-02-28 00:00:00adminsetmessages: + msg3240
2011-02-28 00:00:00adminsetstatus: drafting -> review
2010-08-23 00:00:00adminsetstatus: open -> drafting
2010-01-04 00:00:00admincreate