<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 1509</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="1509"></A><H4>1509.
  
Definition of &#8220;non-template function&#8221;
</H4>
<B>Section: </B>Clause 3&#160; [<A href="https://wg21.link/intro.defs">intro.defs</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Johannes Schaub
 &#160;&#160;&#160;

 <B>Date: </B>2012-06-08<BR>


<P>[Moved to DR at the September, 2013 meeting.]</P>



<P>The term &#8220;non-template function&#8221; is used in various
places but never defined.</P>

<P><B>Proposed resolution (June, 2013):</B></P>

<OL>
<LI><P>Change 7.6.1.3 [<A href="https://wg21.link/expr.call#1">expr.call</A>] paragraph 1 as follows:</P></LI>

<BLOCKQUOTE>

<DEL>There are two kinds of function call: ordinary function call and
member function [<I>Footnote:</I> A static member function
(11.4.9 [<A href="https://wg21.link/class.static">class.static</A>]) is an ordinary function. &#8212;<I>end foot
note</I>] (11.4.2 [<A href="https://wg21.link/class.mfct">class.mfct</A>]) call.</DEL> A function call is a
postfix expression followed by parentheses containing a possibly empty,
comma-separated list of <I>initializer-clause</I>s which constitute the
arguments to the function. <INS>The postfix expression shall have function
type or pointer to function type.</INS> For <DEL>an ordinary
function</DEL> <INS>a</INS> call <INS>to a non-member function or to a
static member function</INS>, the postfix expression shall be either... For
a <DEL>member function</DEL> call <INS>to a non-static member
function</INS>, the postfix expression shall be...

</BLOCKQUOTE>

<LI><P>Add a new paragraph before 9.3.4.6 [<A href="https://wg21.link/dcl.fct#13">dcl.fct</A>] paragraph 13:
</P></LI>

<BLOCKQUOTE>

<P><INS>A <I>non-template function</I> is a function that is not a
function template specialization. [<I>Note:</I> A function template
is not a function. &#8212;<I>end note</I>]</INS></P>

<P>A <I>declarator-id</I> or <I>abstract-declarator</I> containing an
ellipsis shall only be used...</P>

</BLOCKQUOTE>

<LI><P>Change the footnote in 12.2.2 [<A href="https://wg21.link/over.match.funcs#7">over.match.funcs</A>] paragraph 7
as follows:</P></LI>

<BLOCKQUOTE>

The process of argument deduction fully determines the parameter types of
the function template specializations, i.e., the parameters of function
template specializations contain no template parameter
types. Therefore<DEL> the</DEL><INS>, except where specified
otherwise,</INS> function template specializations <DEL>can be treated as
normal (non-template) functions</DEL> <INS>and non-template functions
(9.3.4.6 [<A href="https://wg21.link/dcl.fct">dcl.fct</A>]) are treated equivalently</INS> for the
remainder of overload resolution.

</BLOCKQUOTE>

<LI><P>Change the final sub-bullet of 12.2.2.3 [<A href="https://wg21.link/over.match.oper#3">over.match.oper</A>] paragraph 3
as follows:</P></LI>

<BLOCKQUOTE>

<P>For a unary operator <TT>@</TT>...</P>

<UL>
<LI><P>...</P></LI>

<LI><P>For the operator <TT>,</TT>, the unary operator <TT>&amp;</TT>, or
the operator <TT>-&gt;</TT>, the built-in candidates set...</P></LI>

<UL>
<LI><P>...</P></LI>

<LI><P>do not have the same parameter-type-list as
any <DEL>non-template</DEL> non-member candidate <INS>that is not a
function template specialization</INS>.</P></LI>

</UL>

</UL>

</BLOCKQUOTE>

<LI><P>Change the indicated bullet of the second bulleted list of
12.2.4 [<A href="https://wg21.link/over.match.best#1">over.match.best</A>] paragraph 1 as follows:</P></LI>

<UL>
<LI><P>...</P></LI>

<LI>

<P>
<TT>F1</TT> is <INS>not</INS> a <DEL>non-template</DEL>
function <INS>template specialization</INS> and <TT>F2</TT> is a function
template specialization, or, if not that,</P>
</LI>

<LI><P>...</P></LI>

</UL>

<LI><P>Change 12.3 [<A href="https://wg21.link/over.over#4">over.over</A>] paragraph 4 as follows:</P></LI>

<BLOCKQUOTE>

If more than one function is selected, any function template
specializations in the set are eliminated if the set also contains a
<DEL>non-template</DEL> function <INS>that is not a function template
specialization</INS>, and any given function template
specialization <TT>F1</TT> is eliminated

</BLOCKQUOTE>

<LI><P>Change Clause 13 [<A href="https://wg21.link/temp#5">temp</A>] paragraph 5 as follows:</P></LI>

<BLOCKQUOTE>

A class template shall not have the same name as any other template, class,
function, variable, enumeration, enumerator, namespace, or type in the same
scope (6.4 [<A href="https://wg21.link/basic.scope">basic.scope</A>]), except as specified in
(13.7.6 [<A href="https://wg21.link/temp.spec.partial">temp.spec.partial</A>]). Except that a function template can be
overloaded either by <DEL>(</DEL>non-template<DEL>)</DEL> functions
<INS>(9.3.4.6 [<A href="https://wg21.link/dcl.fct">dcl.fct</A>])</INS> with the same name or by other
function templates with the same name (13.10.4 [<A href="https://wg21.link/temp.over">temp.over</A>]), a
template name declared in namespace scope or in class scope shall be unique
in that scope.

</BLOCKQUOTE>

<LI><P>Change 13.7.3 [<A href="https://wg21.link/temp.mem#2">temp.mem</A>] paragraph 2 as follows:</P></LI>

<BLOCKQUOTE>

<P>A local class of non-closure type shall not have member
templates. Access control rules (11.8 [<A href="https://wg21.link/class.access">class.access</A>]) apply to
member template names. A destructor shall not be a member
template. A <DEL>normal (</DEL>non-template<DEL>)</DEL> member
function <INS>(9.3.4.6 [<A href="https://wg21.link/dcl.fct">dcl.fct</A>])</INS> with a given name and type
and a member function template of the same name, which could be used to
generate a specialization of the same type, can both be declared in a
class. When both exist, a use of that name and type refers to the
non-template member unless an explicit template argument list is
supplied. [<I>Example:</I>
</P>

<PRE>
  template &lt;class T&gt; struct A {
    void f(int);
    template &lt;class T2&gt; void f(T2);
  };

  template &lt;&gt; void A&lt;int&gt;::f(int) { }               //<SPAN CLASS="cmnt"> non-template member <INS>function</INS></SPAN>
  template &lt;&gt; template &lt;&gt; void A&lt;int&gt;::f&lt;&gt;(int) { } //<SPAN CLASS="cmnt"> <DEL>template</DEL> member <INS>function template specialization</INS></SPAN>

  int main() {
    A&lt;char&gt; ac;
    ac.f(1);       //<SPAN CLASS="cmnt"> non-template</SPAN>
    ac.f('c');     //<SPAN CLASS="cmnt"> template</SPAN>
    ac.f&lt;&gt;(1);     //<SPAN CLASS="cmnt"> template</SPAN>
  }
</PRE>

<P>&#8212;<I>end example</I>]</P>

</BLOCKQUOTE>

<LI><P>Change 13.7.5 [<A href="https://wg21.link/temp.friend#1">temp.friend</A>] paragraph 1 as follows:</P></LI>

<BLOCKQUOTE>

<P>A friend of a class or class template can be a function template or
class template, a specialization of a function template or class template,
or <DEL>an ordinary (</DEL> <INS>a</INS> non-template<DEL>)</DEL> function
or class. For a friend function declaration that is not a template
declaration:</P>

<UL>
<LI><P>if the name of the friend is a qualified or
unqualified <I>template-id</I>, the friend declaration refers to a
specialization of a function template, otherwise<INS>,</INS>
</P></LI>

<LI><P>if the name of the friend is a <I>qualified-id</I> and a matching
non-template function is found in the specified class or namespace, the
friend declaration refers to that function, otherwise,</P></LI>

<LI><P>if the name of the friend is a <I>qualified-id</I> and a matching
function template is found in the specified class or namespace, the friend
declaration refers to the deduced specialization of that function template
(13.10.3.7 [<A href="https://wg21.link/temp.deduct.decl">temp.deduct.decl</A>]), otherwise,</P></LI>

<LI><P>the name shall be an <I>unqualified-id</I> that declares (or
redeclares) <DEL>an ordinary (</DEL> <INS>a</INS> non-template<DEL>)</DEL>
function.</P></LI>

</UL>

</BLOCKQUOTE>

<LI><P>Change 13.7.5 [<A href="https://wg21.link/temp.friend#4">temp.friend</A>] paragraph 4 as follows:</P></LI>

<BLOCKQUOTE>

When a function is defined in a friend function declaration in a class
template, the function is instantiated when the function is odr-used
<INS>(6.3 [<A href="https://wg21.link/basic.def.odr">basic.def.odr</A>])</INS>. The
same restrictions...

</BLOCKQUOTE>

<LI><P>Change 13.7.7 [<A href="https://wg21.link/temp.fct#2">temp.fct</A>] paragraph 2 as follows:</P></LI>

<BLOCKQUOTE>

A function template can be overloaded with other function templates and
with <DEL>normal (</DEL>non-template<DEL>)</DEL>
functions <INS>(9.3.4.6 [<A href="https://wg21.link/dcl.fct">dcl.fct</A>])</INS>. A <DEL>normal</DEL>
<INS>non-template</INS> function is not related to a function template
(i.e., it is never considered to be a specialization), even if it has the
same name and type as a potentially generated function template
specialization.<SUP>144</SUP>

</BLOCKQUOTE>

<LI><P>Change 13.10.2 [<A href="https://wg21.link/temp.arg.explicit#4">temp.arg.explicit</A>] paragraph 4 as follows:</P></LI>

<BLOCKQUOTE>

[<I>Note:</I> An empty template argument list can be used to indicate that
a given use refers to a specialization of a function template even when a
<DEL>normal (i.e.,</DEL> non-template<DEL>)</DEL>
function <INS>(9.3.4.6 [<A href="https://wg21.link/dcl.fct">dcl.fct</A>])</INS> is visible that would
otherwise be used. For example:...

</BLOCKQUOTE>

</OL>

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