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

2024-07-24


1382. Dead code for constructor names

Section: 9.3  [dcl.decl]     Status: CD3     Submitter: Johannes Schaub     Date: 2011-08-27

[Moved to DR at the October, 2012 meeting.]

Issue 147 changed the name lookup rules so that a lookup that would have found the injected-class-name of a class will refer to the constructor. However, there still appear to be vestiges of the earlier specification that were not removed by the resolution. For example, the grammar in 9.3 [dcl.decl] paragraph 4 contains,

It would seem that there is no longer any need for the second line, since a lookup for a declarator-id will not produce a class-name. Similarly, _N4567_.5.1.1 [expr.prim.general] paragraph 8 still contains the sentence,

Where class-name :: class-name is used, and the two class-names refer to the same class, this notation names the constructor (11.4.5 [class.ctor]).

Proposed resolution (February, 2012):

  1. Change 9.3 [dcl.decl] paragraph 4 as follows:

  2. A class-name has special meaning in a declaration of the class of that name and when qualified by that name using the scope resolution operator :: (5.1 [lex.separate], 11.4.5 [class.ctor], 11.4.7 [class.dtor]).

  3. Change _N4567_.5.1.1 [expr.prim.general] paragraph 8 as follows:

  4. ...[Note: a class member can be referred to using a qualified-id at any point in its potential scope (6.4.7 [basic.scope.class]). —end note] Where class-name :: class-name is used, and the two class-names refer to the same class, this notation names the constructor (11.4.5 [class.ctor]). Where class-name ::~ class-name is used...