<!-- saved from url=(0022)http://internet.e-mail -->
<HTML>
<HEAD>
   <style>
     <!--
       P.indented {margin-left: 4em}
       XMP.indented {margin-left: 4em}
     -->
   </style>
   <TITLE>
       Definition of Dependent Name
   </TITLE>
</HEAD>

<BODY>

<TABLE ALIGN=RIGHT CELLSPACING=0 CELLPADDING=0 >
<TR>
<TD ALIGN=RIGHT>Document number:</TD>

<TD>&nbsp;00-0028/N1251</TD>
</TR>

<TR>
<TD ALIGN=RIGHT>Date:</TD>

<TD>&nbsp;September 5, 2000</TD>
</TR>

<TR>
<TD ALIGN=RIGHT>Author:</TD>

<TD>&nbsp;John Spicer, Edison Design Group</TD>
</TR>

<TR>
<TD></TD>

<TD>&nbsp;<TT>jhs@edg.com</TT></TD>
</TR>
</TABLE>

<BR CLEAR=ALL>

<CENTER>
<H2>
Definition of Dependent Name
</H2>
</center>

<h3>Introduction</h3>
<p>
This document contains the proposed working paper changes for 
the definition of dependent name.
(See core issue #224.)  This issue was previously discussed
in N1231.
<p>
At the Tokyo meeting, the core group agreed on the direction proposed
in N1231, that the "dependency" of a name should be based on its type,
and not on the form of reference used, and that special rules are needed
to get the desired behavior when referring to names declared within the
class template itself.

<h3>Proposed Changes</h3>
<p>
<h4>
Replace section 14.6.2.1 (temp.dep.type) with the following:
</h4>

In the definition of a class template or a member of a class template,
a name refers to the <em>current instantiation</em> if it is
<ul>
<li>
The injected-class-name of the class template.
<li>
The name of the class template followed by its
<em>template-parameters</em> enclosed in &lt;>.
A <em>template-argument</em> whose value is the
<em>template-parameter</em> may be substituted for a particular
<em>template-parameter</em> when determining whether a given name refers
to the current instantiation.
</ul>
<xmp class=indented>
template <class T> class A {
	A* p1;    // A is the current instantation
	A<T>* p2; // A<T> is the current instantiation
	typedef T TT;
	A<TT>* p3;  // A<TT> is the current instantiation
	A<T*> p4; // A<T*> is not the current instantiation
};
</xmp>

A name is a <em>member of the current instantiation</em> if it is
<ul>
<li>
An unqualified name that, when looked up, refers to a member of a class
template.
<li>
A <em>qualified-id</em> in which the <em>nested-name-specifier</em>
refers to the current instantiation.
</ul>
[Example:
<xmp class=indented>
template <class T> class A {
	static const int i = 5;
	int n1[i];  // i refers to a member of the current instantiation 
	int n2[A::i];  // A::i refers to a member of the current instantiation 
	int n3[A<T>::i];  // A<T>::i refers to a member of the current instantiation 
	int f();
};

template <class T> int A<T>::f()
{
	return i;  // i refers to a member of the current instantiation
}

</xmp>
--end example]
<p>
A name is a <em>member of an unknown specialization</em> if the name
is a <em>qualified-id</em> in which the <em>nested-name-specifier</em>
names a dependent type that is not the current instantiation.
<p>
A type is dependent if it is
<ul>
<li>
a template parameter,
<li>
a member of an unknown specialization,
<li>
a <em>cv-qualified</em> type where the cv-unqualified type is dependent,
<li>
a compound type constructed from any dependent type,
<li>
an array type constructed from any dependent type or whose size is
specified by a constant expression that is value-dependent,
<li>
a <em>template-id</em> in which either the template name is a template
parameter or any of the template arguments is a dependent type or an
expression that is type-dependent or value-dependent.
</ul>

Note: Because typedefs do not introduce new types, but instead simply refer
to other types, a name that refers to a typedef that is a member of the
current instantiation is dependent only if the type referred to is dependent.

<xmp class=indented>
</xmp>

<h4>In 14.6.2.2:</h4>

<p>
Replace
<ul>
<li>
a <em>nested-name-specifier</em> that contains a <em>class-name</em> that
names a dependent type.
</ul>
<p>
with
<ul>
<li>a <em>nested-name-specifier</em> or <em>qualified-id</em> that names
a member of an unknown specialization
</ul>

<p>
Add the following paragraph:
<ul>
A class member access expression ([expr.ref]) is type-dependent
if the type of the referenced member is dependent.
Note: In an expression of the form <code>x.y</code> or
<code>xp->y</code> the type of the expression is usually the type of
the member <code>y</code> of class of <code>x</code> (or the class
pointed to by <code>xp</code>).  However, if <code>x</code> or
<code>xp</code> refers to a dependent type that is not the current
instantiation, the type of <code>y</code> is always dependent.  If
<code>x</code> or <code>xp</code> refers to a non-dependent type or
refers to the current instantiation, the type of <code>y</code> is the
type of the class member access expression.
</ul>


<h3>End of document.</h3>

</body>














