Go forward to Class templates.
Go backward to Template limitations.
Go up to Templates.

Limitations for function templates
==================================

   Function templates are implemented for the most part.  The compiler
can correctly determine template parameter values, and will delay
instantiation of a function that uses templates until the requisite type
information is available.

The following limitations remain:

   * Narrowed specification: function declarations should not prevent
     template expansion.  When you declare a function, GNU C++
     interprets the declaration as an indication that you will provide a
     definition for that function.  Therefore, GNU C++ does not use a
     template expansion if there is also an applicable declaration.  GNU
     C++ only expands the template when there is no such declaration.

     The specification in Bjarne Stroustrup's `The C++ Programming
     Language, Second Edition' is narrower, and the GNU C++
     implementation is now clearly incorrect.  With this new
     specification, a declaration that corresponds to an instantiation
     of a function template only affects whether conversions are needed
     to use that version of the function.  It should no longer prevent
     expansion of the template definition.

     For example, this code fragment must be treated differently:

          template <class X> X min (X& x1, X& x2) { ... }
          int min (int, int);
          ...
          int i; short s;
          min (i, s); // should call min(int,int)
                      // derived from template
          ...

   * The compiler does not yet understand function signatures where
     types are nested within template parameters.  For example, a
     function like the following produces a syntax error on the closing
     `)' of the definition of the function `f':

          template <class T> class A { public: T x; class Y {}; };
          template <class X> int f (A<X>::Y y) { ... }

   * If you declare an `inline' function using templates, the compiler
     can only inline the code *after* the first time you use that
     function with whatever particular type signature the template was
     instantiated.

     Removing this limitation is akin to supporting nested function
     definitions in GNU C++; the limitation will probably remain until
     the more general problem of nested functions is solved.

   * All the *method* templates (templates for member functions) for a
     class must be visible to the compiler when the class template is
     instantiated.