Title
Syntax of declarator-id
Status
tc1
Section
11.3 [dcl.meaning]
Submitter
Mike Miller

Created on 1998-09-01.00:00:00 last changed 208 months ago

Messages

Date: 1999-10-15.00:00:00

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

Change 11.3 [dcl.meaning] paragraph 1 from:

A declarator-id shall not be qualified except for the definition of a member function (12.2.1 [class.mfct] ) or static data member (12.2.3 [class.static] ) or nested class (12.2.5 [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 (12.2.1 [class.mfct] ) or static data member (12.2.3 [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...
Date: 1999-04-15.00:00:00

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 11.3 [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...
Date: 2003-04-25.00:00:00

(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 11.3 [dcl.meaning] paragraph 1,

The id-expression of a declarator-id shall be a simple identifier except for the declaration of some special functions (15.3 [class.conv] , 15.4 [class.dtor] , 16.5 [over.oper] ) and for the declaration of template specializations or partial specializations (17.8 [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 (12.2.1 [class.mfct] ) or static data member (12.2.3 [class.static] ) or nested class (12.2.5 [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:

    declarator-id :
      id-expression
      ::opt  nested-name-specifieropt type-name
    id-expression :
      unqualified-id
      qualified-id
    unqualified-id :
      identifier
      operator-function-id
      conversion-function-id
      ~ class-name
      template-id
The exceptions in the citation from 11.3 [dcl.meaning] paragraph 1 are all the non-identifier cases of unqualified-id: 15.3 [class.conv] is for conversion-function-ids, 15.4 [class.dtor] is for destructors, 16.5 [over.oper] is for overloaded operators, and 17.8 [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.

History
Date User Action Args
2003-04-25 00:00:00adminsetstatus: dr -> tc1
2000-02-23 00:00:00adminsetmessages: + msg298
2000-02-23 00:00:00adminsetstatus: ready -> dr
1999-09-14 00:00:00adminsetmessages: + msg81
1999-09-14 00:00:00adminsetstatus: drafting -> ready
1998-09-01 00:00:00admincreate