title: Is it legal to omit template type arguments when instantiating a function template?
body: <p>The following code implements a function template <code>foo</code> that accepts an arbitrary number of arguments, and subsequently handles each one while maintaining a positional index of that argument:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>template&lt;int index, typename T&gt;
  void foo_impl(T value)
  {
      // Do something with index/value
  }
  
  template&lt;int index, typename T, typename... Rest&gt;
  void foo_impl(T value, Rest... values)
  {
      // Do something with index/value
      // Recursively handle remaining arguments
      foo_impl&lt;index + 1&gt;(values...);
  }
  
  template&lt;typename... T&gt;
  void foo(T... args)
  {
      foo_impl&lt;1&gt;(args...);
  }
  
  int main()
  {
      foo("test", 42);
  }
  </code></pre>
  
  <p>This recursively instantiates function templates until it reaches the base template that takes a single argument. Every function template instantiation of <code>foo_impl</code> omits the template type arguments. Although this <a href="https://godbolt.org/z/kG_STo" rel="nofollow noreferrer">compiles with Clang, GCC, and MSVC</a>, I'm not sure this is legal.</p>
  
  <p>Is it legal to omit the template arguments as illustrated in the code example? If so, what are the specific rules? And have those rules changed between C++ Standards?</p>