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

2024-03-20


40. Syntax of declarator-id

Section: 9.3.4  [dcl.meaning]     Status: TC1     Submitter: Mike Miller     Date: 01 Sep 1998

(From J16/99-0005 = WG21 N1182, "Proposed Resolutions for Core Language Issues 6, 14, 20, 40, and 89")

There are two sub-issues. The first concerns the statement in 9.3.4 [dcl.meaning] paragraph 1,

The id-expression of a declarator-id shall be a simple identifier except for the declaration of some special functions (11.4.8 [class.conv] , 11.4.7 [class.dtor] , 12.4 [over.oper] ) and for the declaration of template specializations or partial specializations (13.9 [temp.spec] ).
The second sub-issue is regarding another statement in the same paragraph:
A declarator-id shall not be qualified except for the definition of a member function (11.4.2 [class.mfct] ) or static data member (11.4.9 [class.static] ) or nested class (11.4.12 [class.nest] ) outside of its class, the definition or explicit instantiation of a function, variable or class member of a namespace outside of its namespace, or...
Analysis

The problem in the first sub-issue is that the wrong syntactic non-terminal is mentioned. The relevant portions of the grammar are:

The exceptions in the citation from 9.3.4 [dcl.meaning] paragraph 1 are all the non-identifier cases of unqualified-id: 11.4.8 [class.conv] is for conversion-function-ids, 11.4.7 [class.dtor] is for destructors, 12.4 [over.oper] is for overloaded operators, and 13.9 [temp.spec] is for template-ids. If taken literally, this sentence would exclude all qualified-ids, which it obviously is not intended to do. Instead, the apparent intent is something along the lines of
If an unqualified-id is used as the id-expression of a declarator-id, it shall be a simple identifier except...
However, it does not appear that this restriction has any meaning; all of the possible cases of unqualified-ids are represented in the list of exceptions! Rather than recasting the sentence into a correct but useless form, it would be better to remove it altogether.

The second sub-issue deals with the conditions under which a qualified-id can be used in a declarator, including "the definition of a...nested class" and "the definition or explicit instantiation of a...class member of a namespace." However, the name in a class definition is not part of a declarator; these constructs do not belong in a list of declarator contexts.

Proposed Resolution for sub-issue 1 (04/99):

The suggested resolution for the first sub-issue overlooked the fact that the existing wording has the additional effect of prohibiting the use of the non-identifier syntax for declaring other than the listed entities. Thus the proposed wording for the first sub-issue is:

Change 9.3.4 [dcl.meaning] paragraph 1 from:

The id-expression of a declarator-id shall be a simple identifier except...
to:
An unqualified-id occurring in a declarator-id shall be a simple identifier except...

Proposed Resolution for sub-issue 2 (10/99):

Change 9.3.4 [dcl.meaning] paragraph 1 from:

A declarator-id shall not be qualified except for the definition of a member function (11.4.2 [class.mfct] ) or static data member (11.4.9 [class.static] ) or nested class (11.4.12 [class.nest] ) outside of its class, the definition or explicit instantiation of a function, variable or class member of a namespace outside of its namespace, or...
to
A declarator-id shall not be qualified except for the definition of a member function (11.4.2 [class.mfct] ) or static data member (11.4.9 [class.static] ) outside of its class, the definition or explicit instantiation of a function or variable member of a namespace outside of its namespace, or...