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


2642. Inconsistent use of T and C

Section: 6.5.2  [class.member.lookup]     Status: C++23     Submitter: US     Date: 2022-11-03

[Accepted as a DR at the February, 2023 meeting.]

P2720R0 comment US 7-035

T and C are used inconsistently throughout these paragraphs.

Proposed resolution [SUPERSEDED]:

  1. Change in 6.5.2 [class.member.lookup] paragraph 1 as follows:

    A search in a scope X for a name N from a program point P is a single search in X for N from P unless X is the scope of a class or class template T C, in which case the following steps define the result of the search.
  2. Change in 6.5.2 [class.member.lookup] paragraph 4 as follows:

    [Note 2: If T C is incomplete, only base classes whose base-specifier appears before P are considered. If T C is an instantiated class, its base classes are not dependent. —end note]
  3. Change in 6.5.2 [class.member.lookup] paragraph 6 as follows:

    The result of the search is the declaration set of S(N, T C). If it is an invalid set, the program is ill-formed. If it differs from the result of a search in T C for N in a complete-class context (11.4 [class.mem]) of T C, the program is ill-formed, no diagnostic required.
  4. Change in 6.5.2 [class.member.lookup] paragraph 7 as follows:

    If N is a non-dependent conversion-function-id, conversion function templates that are members of T C are considered. For each such template F, the lookup set S(t, T C) is constructed, considering a function template declaration to have the name t only if it corresponds to a declaration of F (6.4.1 [basic.scope.scope]).
  5. Change in 6.5.2 [class.member.lookup] paragraph 8 as follows:

    [Note 4: A static member, a nested type or an enumerator defined in a base class T B can unambiguously be found even if an object has more than one base class subobject of type T B. Two base class subobjects share the non-static member subobjects of their common virtual base classes. —end note]

CWG 2022-12-02

The resolution proposed above is incorrect: T is the parameter for the overall search and C is the parameter for the S(N,C) construction. Highlight that fact in paragraph 2.

Proposed resolution (approved by CWG 2023-01-06):

  1. Change in 6.5.2 [class.member.lookup] paragraph 1 as follows:

    A search in a scope X for a name N M from a program point P is a single search in X for N M from P unless X is the scope of a class or class template T, in which case the following steps define the result of the search. [Note 1: The result differs only if N M is a conversion-function-id or if the single search would find nothing. —end note]
  2. Change in 6.5.2 [class.member.lookup] paragraph 2 as follows:

    The lookup set for a name N in a class or class template C, called S(N, C), consists of two component sets: the declaration set, a set of members named N ; and the subobject set, a set of subobjects where declarations of these members were found (possibly via using-declarations). In the declaration set, type declarations (including injected-class-names) are replaced by the types they designate. S(N, C) is calculated as follows:
  3. Change in 6.5.2 [class.member.lookup] paragraph 4 as follows:

    ... [Note 2: If T C is incomplete, only base classes whose base-specifier appears before P are considered. If T C is an instantiated class, its base classes are not dependent. —end note]
  4. Change in 6.5.2 [class.member.lookup] paragraph 6 as follows:

    The result of the search is the declaration set of S(NM, T). If it is an invalid set, the program is ill-formed. If it differs from the result of a search in T for N M in a complete-class context (11.4 [class.mem]) of T , the program is ill-formed, no diagnostic required.
  5. Change in 6.5.2 [class.member.lookup] paragraph 7 as follows:

    If N M is a non-dependent conversion-function-id, conversion function templates that are members of T are considered. For each such template F, the lookup set S(t, T) is constructed, considering a function template declaration to have the name t only if it corresponds to a declaration of F (6.4.1 [basic.scope.scope]). The members of the declaration set of each such lookup set, which shall not be an invalid set, are included in the result.