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

2024-10-26


1310. What is an “acceptable lookup result?”

Section: 6.5.5.2  [class.qual]     Status: CD3     Submitter: Jason Merrill     Date: 2011-05-06

[Moved to DR at the April, 2013 meeting.]

In 6.5.5.2 [class.qual] paragraph 2,

In a lookup in which the constructor is an acceptable lookup result and the nested-name-specifier nominates a class C:

the name is instead considered to name the constructor of class C.

it is not clear what constitutes “an acceptable lookup result.” For instance, is

  struct S { } *sp = new S::S;

well-formed?

The intent of the wording was that S::S would refer to the constructor except in lookups that ignore the names of functions, e.g., in elaborated-type-specifiers and nested-name-specifiers. There doesn't seem to be a good reason to allow a qualified-id naming the injected-class-name. The alternative, i.e., only to find the constructor in a declarator, complicates parsing because the determination of whether the name is a type or a function would require lookahead.

Proposed resolution (August, 2012):

Change 6.5.5.2 [class.qual] paragraph 2 as follows:

In a lookup in which the constructor is an acceptable lookup result function names are not ignored [Footnote: Lookups in which function names are ignored include names appearing in a nested-name-specifier, an elaborated-type-specifier, or a base-specifier. —end footnote] and the nested-name-specifier nominates a class C:

the name is instead considered to name the constructor of class C...