Definition of “non-template function”
Clause [3] [intro.defs]
Johannes Schaub

Created on 2012-06-08.00:00:00 last changed 81 months ago


Date: 2013-09-15.00:00:00

[Moved to DR at the September, 2013 meeting.]

Date: 2013-06-15.00:00:00

Proposed resolution (June, 2013):

  1. Change [expr.call] paragraph 1 as follows:

  2. There are two kinds of function call: ordinary function call and member function [Footnote: A static member function (11.4.9 [class.static]) is an ordinary function. —end foot note] (11.4.2 [class.mfct]) call. A function call is a postfix expression followed by parentheses containing a possibly empty, comma-separated list of initializer-clauses which constitute the arguments to the function. The postfix expression shall have function type or pointer to function type. For an ordinary function a call to a non-member function or to a static member function, the postfix expression shall be either... For a member function call to a non-static member function, the postfix expression shall be...
  3. Add a new paragraph before [dcl.fct] paragraph 13:

  4. A non-template function is a function that is not a function template specialization. [Note: A function template is not a function. —end note]

    A declarator-id or abstract-declarator containing an ellipsis shall only be used...

  5. Change the footnote in 12.2.2 [over.match.funcs] paragraph 7 as follows:

  6. 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 the, except where specified otherwise, function template specializations can be treated as normal (non-template) functions and non-template functions ( [dcl.fct]) are treated equivalently for the remainder of overload resolution.
  7. Change the final sub-bullet of [over.match.oper] paragraph 3 as follows:

  8. For a unary operator @...

    • ...

    • For the operator ,, the unary operator &, or the operator ->, the built-in candidates set...

      • ...

      • do not have the same parameter-type-list as any non-template non-member candidate that is not a function template specialization.

  9. Change the indicated bullet of the second bulleted list of 12.2.4 [over.match.best] paragraph 1 as follows:

    • ...

    • F1 is not a non-template function template specialization and F2 is a function template specialization, or, if not that,

    • ...

  10. Change 12.3 [over.over] paragraph 4 as follows:

  11. If more than one function is selected, any function template specializations in the set are eliminated if the set also contains a non-template function that is not a function template specialization, and any given function template specialization F1 is eliminated
  12. Change Clause 13 [temp] paragraph 5 as follows:

  13. 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 [basic.scope]), except as specified in (_N4868_.13.7.6 [temp.class.spec]). Except that a function template can be overloaded either by (non-template) functions ( [dcl.fct]) with the same name or by other function templates with the same name (13.10.4 [temp.over]), a template name declared in namespace scope or in class scope shall be unique in that scope.
  14. Change 13.7.3 [temp.mem] paragraph 2 as follows:

  15. A local class of non-closure type shall not have member templates. Access control rules (Clause 11.8 [class.access]) apply to member template names. A destructor shall not be a member template. A normal (non-template) member function ( [dcl.fct]) 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. [Example:

      template <class T> struct A {
        void f(int);
        template <class T2> void f(T2);
      template <> void A<int>::f(int) { }               // non-template member function
      template <> template <> void A<int>::f<>(int) { } // template member function template specialization
      int main() {
        A<char> ac;
        ac.f(1);       // non-template
        ac.f('c');     // template
        ac.f<>(1);     // template

    end example]

  16. Change 13.7.5 [temp.friend] paragraph 1 as follows:

  17. 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 an ordinary ( a non-template) function or class. For a friend function declaration that is not a template declaration:

    • if the name of the friend is a qualified or unqualified template-id, the friend declaration refers to a specialization of a function template, otherwise,

    • if the name of the friend is a qualified-id and a matching non-template function is found in the specified class or namespace, the friend declaration refers to that function, otherwise,

    • if the name of the friend is a qualified-id 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 ( [temp.deduct.decl]), otherwise,

    • the name shall be an unqualified-id that declares (or redeclares) an ordinary ( a non-template) function.

  18. Change 13.7.5 [temp.friend] paragraph 4 as follows:

  19. When a function is defined in a friend function declaration in a class template, the function is instantiated when the function is odr-used (6.3 [basic.def.odr]). The same restrictions...
  20. Change 13.7.7 [temp.fct] paragraph 2 as follows:

  21. A function template can be overloaded with other function templates and with normal (non-template) functions ( [dcl.fct]). A normal non-template 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.144
  22. Change 13.10.2 [temp.arg.explicit] paragraph 4 as follows:

  23. [Note: 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 normal (i.e., non-template) function ( [dcl.fct]) is visible that would otherwise be used. For example:...
Date: 2012-06-08.00:00:00

The term “non-template function” is used in various places but never defined.

Date User Action Args
2014-11-24 00:00:00adminsetstatus: drwp -> c++14
2014-03-03 00:00:00adminsetstatus: dr -> drwp
2013-10-14 00:00:00adminsetmessages: + msg4678
2013-10-14 00:00:00adminsetstatus: tentatively ready -> dr
2013-09-03 00:00:00adminsetmessages: + msg4452
2013-09-03 00:00:00adminsetstatus: drafting -> tentatively ready
2012-11-03 00:00:00adminsetstatus: open -> drafting
2012-06-08 00:00:00admincreate