<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - incorrectly accepts non-deductible template parameter pack in function template"
   href="https://llvm.org/bugs/show_bug.cgi?id=31330">31330</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>incorrectly accepts non-deductible template parameter pack in function template
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.9
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++14
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>felix.morgner@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>clang++ incorrectly accepts the following code that contains a non-deductible
template parameter pack:

  #include <utility>

  template<std::size_t ...Ns, typename ...Ts>
  void foo(std::index_sequence<Ns...>)
    {
    }

  int main()
    {
    foo(std::make_index_sequence<5>{});
    }

ISO14882:2014 states the following in [temp.param]:

(9) [...] A default template-argument may be specified for any kind of
template-parameter (type, non-type, template) that is not a template parameter
pack (14.5.3). [...]

(11) [...]  A template parameter pack of a function template shall not be
followed by another template parameter unless that template parameter can be
deduced from the parameter-type-list of the function template or has a default
argument (14.8.2).

It also gives an example similar to the above. As far as I can tell, it is
neither possible to deduce nor to specify the types for 'Ts' and thus this
template function should be rejected.

The example code was compiled with the following command line invocation:

  clang++ -Wall -Wextra -pedantic -pedantic-errors -Werror -std=c++14 templ.cpp</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>