<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 2642</TITLE>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<STYLE TYPE="text/css">
  INS { text-decoration:none; font-weight:bold; background-color:#A0FFA0 }
  .INS { text-decoration:none; background-color:#D0FFD0 }
  DEL { text-decoration:line-through; background-color:#FFA0A0 }
  .DEL { text-decoration:line-through; background-color: #FFD0D0 }
  @media (prefers-color-scheme: dark) {
    HTML { background-color:#202020; color:#f0f0f0; }
    A { color:#5bc0ff; }
    A:visited { color:#c6a8ff; }
    A:hover, a:focus { color:#afd7ff; }
    INS { background-color:#033a16; color:#aff5b4; }
    .INS { background-color: #033a16; }
    DEL { background-color:#67060c; color:#ffdcd7; }
    .DEL { background-color:#67060c; }
  }
  SPAN.cmnt { font-family:Times; font-style:italic }
</STYLE>
</HEAD>
<BODY>
<P><EM>This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21
  Core Issues List revision 118b.
  See http://www.open-std.org/jtc1/sc22/wg21/ for the official
  list.</EM></P>
<P>2025-09-28</P>
<HR>
<A NAME="2642"></A><H4>2642.
  
Inconsistent use of T and C
</H4>
<B>Section: </B>6.5.2&#160; [<A href="https://wg21.link/class.member.lookup">class.member.lookup</A>]
 &#160;&#160;&#160;

 <B>Status: </B>C++23
 &#160;&#160;&#160;

 <B>Submitter: </B>US
 &#160;&#160;&#160;

 <B>Date: </B>2022-11-03<BR><BR>


<P>[Accepted as a DR at the February, 2023 meeting.]</P>

<A href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2720r0.pdf#US7-035">P2720R0 comment
  US&#160;7-035<BR></A>

<P>T and C are used inconsistently throughout these paragraphs.</P>

<P><B>Proposed resolution [SUPERSEDED]:</B></P>

<OL>

<LI>

<P>Change in 6.5.2 [<A href="https://wg21.link/class.member.lookup#1">class.member.lookup</A>] paragraph 1 as follows:</P>

<BLOCKQUOTE>

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 <DEL>T</DEL> <INS>C</INS>, in which case the following steps
define the result of the search.

</BLOCKQUOTE>

</LI>

<LI>

<P>Change in 6.5.2 [<A href="https://wg21.link/class.member.lookup#4">class.member.lookup</A>] paragraph 4 as follows:</P>

<BLOCKQUOTE>

[<I>Note 2:</I> If <DEL>T</DEL> <INS>C</INS> is incomplete, only base
classes whose <I>base-specifier</I> appears before P are
considered. If <DEL>T</DEL> <INS>C</INS> is an instantiated class, its
base classes are not dependent. &#8212;<I>end note</I>]

</BLOCKQUOTE>

</LI>

<LI>

<P>Change in 6.5.2 [<A href="https://wg21.link/class.member.lookup#6">class.member.lookup</A>] paragraph 6 as follows:</P>

<BLOCKQUOTE>

The result of the search is the declaration set of
S(N, <DEL>T</DEL> <INS>C</INS>). If it is an invalid set, the program
is ill-formed.  If it differs from the result of a search
in <DEL>T</DEL> <INS>C</INS> for N in a complete-class context
(11.4 [<A href="https://wg21.link/class.mem">class.mem</A>]) of <DEL>T</DEL> <INS>C</INS>, the program
is ill-formed, no diagnostic required.

</BLOCKQUOTE>

</LI>

<LI>

<P>Change in 6.5.2 [<A href="https://wg21.link/class.member.lookup#7">class.member.lookup</A>] paragraph 7 as follows:</P>

<BLOCKQUOTE>

If N is a non-dependent <I>conversion-function-id</I>, conversion
function templates that are members of <DEL>T</DEL> <INS>C</INS> are
considered. For each such template F, the lookup set
S(t, <DEL>T</DEL> <INS>C</INS>) is constructed, considering a function
template declaration to have the name t only if it corresponds to a
declaration of F (6.4.1 [<A href="https://wg21.link/basic.scope.scope">basic.scope.scope</A>]).

</BLOCKQUOTE>

</LI>

<LI>

<P>Change in 6.5.2 [<A href="https://wg21.link/class.member.lookup#8">class.member.lookup</A>] paragraph 8 as follows:</P>

<BLOCKQUOTE>

[<I>Note 4:</I> A static member, a nested type or an enumerator
defined in a base class <DEL>T</DEL> <INS><TT>B</TT></INS> can
unambiguously be found even if an object has more than one base class
subobject of type <DEL>T</DEL> <INS><TT>B</TT></INS>. Two base class
subobjects share the non-static member subobjects of their common
virtual base classes. &#8212;<I>end note</I>]

</BLOCKQUOTE>

</LI>

</OL>

<P><B>CWG 2022-12-02</B></P>

<P>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.</P>

<P><B>Proposed resolution (approved by CWG 2023-01-06):</B></P>

<OL>

<LI>
<P>Change in 6.5.2 [<A href="https://wg21.link/class.member.lookup#1">class.member.lookup</A>] paragraph 1 as follows:</P>

<BLOCKQUOTE>

A search in a scope X for a name <DEL>N</DEL> <INS>M</INS> from a
program point P is a single search in X for <DEL>N</DEL> <INS>M</INS>
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.  [<I>Note
1:</I> The result differs only if <DEL>N</DEL> <INS>M</INS> is
a <I>conversion-function-id</I> or if the single search would find
nothing. &#8212;<I>end note</I>]

</BLOCKQUOTE>

</LI>

<LI>

<P>Change in 6.5.2 [<A href="https://wg21.link/class.member.lookup#2">class.member.lookup</A>] paragraph 2 as follows:</P>

<BLOCKQUOTE>

The lookup set for <INS>a name</INS> N in <INS>a class or class
template</INS> 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 <I>using-declaration</I>s). In the declaration set, type
declarations (including injected-class-names) are replaced by the
types they designate. S(N, C) is calculated as follows:

</BLOCKQUOTE>

</LI>

<LI>
<P>Change in 6.5.2 [<A href="https://wg21.link/class.member.lookup#4">class.member.lookup</A>] paragraph 4 as follows:</P>

<BLOCKQUOTE>

... [<I>Note 2:</I> If <DEL>T</DEL> <INS>C</INS> is incomplete, only
base classes whose <I>base-specifier</I> appears before P are
considered. If <DEL>T</DEL> <INS>C</INS> is an instantiated class, its
base classes are not dependent. &#8212;<I>end note</I>]

</BLOCKQUOTE>

</LI>

<LI>
<P>Change in 6.5.2 [<A href="https://wg21.link/class.member.lookup#6">class.member.lookup</A>] paragraph 6 as follows:</P>

<BLOCKQUOTE>

The result of the search is the declaration set of
S(<DEL>N</DEL><INS>M</INS>, T). If it is an invalid set, the program
is ill-formed.  If it differs from the result of a search in T
for <DEL>N</DEL> <INS>M</INS> in a complete-class context
(11.4 [<A href="https://wg21.link/class.mem">class.mem</A>]) of T , the program is ill-formed, no
diagnostic required.

</BLOCKQUOTE>

</LI>

<LI>
<P>Change in 6.5.2 [<A href="https://wg21.link/class.member.lookup#7">class.member.lookup</A>] paragraph 7 as follows:</P>

<BLOCKQUOTE>

If <DEL>N</DEL> <INS>M</INS> is a
non-dependent <I>conversion-function-id</I>, 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 [<A href="https://wg21.link/basic.scope.scope">basic.scope.scope</A>]). The members of the
declaration set of each such lookup set, which shall not be an invalid
set, are included in the result.

</BLOCKQUOTE>

</LI>

</OL>

<BR><BR>
</BODY>
</HTML>
