<HTML>
<HEAD>
   <style>
     <!--
       P.indented {margin-left: 4em}
       XMP.indented {margin-left: 4em}
     -->
   </style>
   <TITLE>
       Drafting from Tokyo Meeting - Revision 2
   </TITLE>
</HEAD>

<BODY>

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

<TD>&nbsp;00-0026/N1249</TD>
</TR>

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

<TD>&nbsp;April 19, 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>
Drafting from Tokyo Meeting - Revision 2
</H2>
</center>

<h3>Introduction</h3>
<p>
This document contains the proposed wording for the changes in the
standard associated with the following issues from the core issues list.
<ol>
<li><a href="#issue176">
176. Name injection and class templates.
</a>
<li><a href="#issue183">
183. Use of <tt>typename</tt> in explicit specializations.
</a>
<li><a href="#issue206">
206. Semantic constraints on nondependent names
</a>
<li><a href="#issue213">
213. Lookup in dependent base classes.
</a>
<li><a href="#issue217">
217. Default arguments for member functions of class templates.
</a>
</ol>

<h3>
<a name="issue176">
176. Name injection and class templates.
</a>
</h3>
<p>
Note: These changes depend on the changes for issue 147 ("Naming the
Constructor"), which is currently in "ready" status.
<p>
In 14.6.1p1, replace
<blockquote>
<p>
Within the scope of a class template, when the name of the template is
neither qualified nor followed by &lt;, it is equivalent to the name of
the template followed by the template-parameters enclosed in &lt;>.
[Example: the constructor for Set can be referred to as Set() or
Set&lt;T>(). ] Other specializations (_temp.expl.spec_) of the class can
be referred to by explicitly qualifying the template name with the
appropriate template-arguments.  [Example:
<xmp class=indented>
template<class T> class X {
        X* p;                   // meaning X<T>
        X<T>* p2;
        X<int>* p3;
};
</xmp>
--end example]
<p>
Within the scope of a class template specialization or partial
specialization, when the name of the template is neither qualified nor
followed by &lt;, it is equivalent to the name of the template followed
by the template-arguments enclosed in &lt;>.
</blockquote>
<p>
With
<blockquote>
Like normal (non-template) classes, class templates have an
injected-class-name.  The injected-class-name can be
used with or without a <em>template-argument-list</em>.  When it is used
without a <em>template-argument-list</em> it is equivalent to the
injected-class-name followed by the <em>template-parameters</em>
of the class template enclosed in &lt;>.
When it is used with a <em>template-argument-list</em> it refers to the
specified class template specialization, which could be the current
specialization or another specialization.
<p>
Within the scope of a class template specialization or partial
specialization, when the injected-class-name is not followed by
a &lt, it is equivalent to the injected-class-name followed
by the <em>template-arguments</em> of the class template specialization
or partial specialization enclosed in &lt;>.
[Example:
<xmp class=indented>
template<class T> class Y;

template<> class Y<int> {
        Y* p;                   // meaning Y<int>
        Y<char>* q;             // meaning Y<char>
};
</xmp>
--end example]
<p>
The injected-class-name of a class template or class template
specialization can be used either with or without a
<em>template-argument-list</em> wherever it is in scope.
[Example:
<xmp class=indented>
template <class T> struct Base {
	Base *p;
};

template <class T> struct Derived : public Base<T> {
	typename Derived::Base* p;  // meaning Derived::Base<T>
};
</xmp>
--end example]
<p>
A lookup that finds an injected-class-name (class.member.lookup) can result
in an ambiguity in certain cases (for example, if it is found in more than
one base class).
If all of the injected-class-names that are found refer to specializations
of the same class template, and if the name is followed by a
template-argument-list, the reference refers to the class template
itself and not a specialization thereof, and is not ambiguous.
[Example:
<xmp class=indented>
template <class T> struct Base {};
template <class T> struct Derived : Base<int>, Base<char> {
	typename Derived::Base	b;          // error: ambiguous
	typename Derived::Base<double>	d;  // okay
};
</xmp>
--end example]
<p>
When the normal name of the template (i.e., the name from the
enclosing scope, not the injected-class-name)
is used without a <em>template-argument-list</em> it refers to the
class template itself and not a specialization of the template.
[Example:
<xmp class=indented>
template<class T> class X {
        X* p;                   // meaning X<T>
        X<T>* p2;
        X<int>* p3;
        ::X* p4; // error: missing template argument list
                 // ::X does not refer to the injected-class-name
};
</xmp>
--end example]
</blockquote>

<h3>
<a name="issue183">
183. Use of <tt>typename</tt> in explicit specializations.
</a>
</h3>
<p>
In 14.6p5, replace
<blockquote>
The keyword <tt>typename</tt> shall only be applied to qualified names,
but those names need not be dependent.
</blockquote>
<p>
With
<blockquote>
The keyword <tt>typename</tt> shall be applied only to qualified names,
but those names need not be dependent.
The keyword <tt>typename</tt> shall be used only in contexts in which
dependent names can be used.  This includes template declarations and
definitions but excludes explicit specialization declarations and
explicit instantiation declarations.
</blockquote>

<h3>
<a name="issue206">
206. Semantic constraints on nondependent names
</a>
</h3>
<p>
In 14.6p7 after the following text
<blockquote>
Knowing which names are type names allows the syntax of every template
definition to be checked. No diagnostic shall be issued for a template
definition for which a valid specialization can be generated.
If no valid specialization can be generated for a template definition,
and that template is not instantiated, the template definition is
ill-formed, no diagnostic required.
</blockquote>
Add the following
<blockquote>
If a type used in a non-dependent name is incomplete at the point at
which a template is defined but is complete at the point at which an
instantiation is done, and if the completeness of that type affects
whether or not the program is well-formed or affects the semantics of
the program, the program is ill-formed; no diagnostic is required.
</blockquote>

<h3>
<a name="issue213">
213. Lookup in dependent base classes.
</a>
</h3>
<p>
In 14.6.2p3, replace
<blockquote>
In the definition of a class template or in the definition of a member
of such a template that appears outside of the template definition, if
a base class of this template depends on a template-parameter, the
base class scope is not examined during name lookup until the class
template is instantiated.
</blockquote>
With
<blockquote>
In the definition of a class template or a member of a class template, if
a base class of the class template depends on a template-parameter, the
base class scope is not examined during unqualified name lookup
either at the point of definition of the class template or member or
during an instantiation of the class template or member.
</blockquote>
<p>
Remove from 14.6.2p4
<blockquote>
If a base class is a dependent type, a member of that class cannot hide a name
declared within a template, or a name from the template's enclosing scopes.
</blockquote>

<h3>
<a name="issue217">
217. Default arguments for member functions of class templates.
</a>
</h3>
<p>
In 8.3.6p6, replace
<blockquote>
The default arguments in a member function definition that appears
outside of the class definition are added to the set of default arguments
provided by the member function declaration in the class definition.
</blockquote>
<p>
With
<blockquote>
Except for member functions of class templates, the default arguments in a
member function definition that appears outside of the class definition
are added to the set of default arguments provided by the member function
declaration in the class definition.  Default arguments for a member
function of a class template must be specified on the initial declaration of
the member function within the class template.
</blockquote>

<xmp class=indented>
</xmp>

<h3>End of document.</h3>

</body>
