This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115f. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-12-06
[Moved to DR at the October, 2015 meeting.]
In an example like
void f() {
f(); // #1
}
The statement at #1 is ambiguous and can be parsed as either an expression or as a declaration. The problem is the fact that the decl-specifier-seq in a simple-declaration is optional.
Proposed resolution (May, 2015):
Change the grammar in 9.1 [dcl.pre] paragraph 1 as follows:
Change 9.1 [dcl.pre] paragraph 2 as follows:
TheA simple-declaration or nodeclspec-function-declaration of the formattribute-specifier-seqopt decl-specifier-seqopt init-declarator-listopt ;
is divided into three parts. Attributes are described in 9.12 [dcl.attr]. decl-specifiers, the principal components of a decl-specifier-seq, are described in 9.2 [dcl.spec]. declarators, the components of an init-declarator-list, are described in 9.3 [dcl.decl]. The attribute-specifier-seq
in a simple-declarationappertains to each of the entities declared by the declarators of the init-declarator-list. [Note:...
Change 9.1 [dcl.pre] paragraph 11 as follows:
Only in function declarations forA nodeclspec-function-declaration shall declare a constructors, destructors,and typeor conversionsfunctioncan the decl-specifier-seq be omitted.93 [Note: a nodeclspec-function-declaration can only be used in a template-declaration (Clause 13 [temp]), explicit-instantiation (13.9.3 [temp.explicit]), or explicit-specialization (13.9.4 [temp.expl.spec]). —end note]
Change 9.3.4 [dcl.meaning] paragraph 1 as follows:
A list of declarators appears after an optional ( 9.1 [dcl.pre]) decl-specifier-seq (9.2 [dcl.spec]). EachA declarator contains exactly one declarator-id; it names the identifier...
Change 11.4.5 [class.ctor] paragraph 1 as follows:
...In a constructor declaration, eachEach decl-specifier in theoptionaldecl-specifier-seq of a constructor declaration (if any) shall be friend, inline, explicit, or constexpr. [Example:...
Change 11.4.8.3 [class.conv.fct] paragraph 1 as follows:
...Such functions are called conversion functions.No return type can be specified.A decl-specifier in the decl-specifier-seq of a conversion function (if any) shall be neither a type-specifier nor static.If a conversion function is a member function, theThe type of the conversion function (9.3.4.6 [dcl.fct]) is...
Delete 11.4.8.3 [class.conv.fct] paragraph 6:
Conversion functions cannot be declared static.
Change 11.4.7 [class.dtor] paragraph 1 as follows:
...In a destructor declaration, eachEach decl-specifier of theoptionaldecl-specifier-seq of a destructor declaration (if any) shall be friend, inline, or virtual.
This resolution also resolves issue 2016.