<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 --- - Incorrect deduction of parameter pack"
   href="https://llvm.org/bugs/show_bug.cgi?id=26357">26357</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Incorrect deduction of parameter pack
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </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++11
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>ldionne.2@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following code fails to compile on Clang trunk:

------------------------------------------------------------------------------
#include <cstddef>
#include <utility>


template <std::size_t I, typename T>
struct elt { };

template <typename Indices, typename ...T>
struct indexer;

template <std::size_t ...I, typename ...T>
struct indexer<std::index_sequence<I...>, T...>
    : elt<I, T>...
{ };

template <typename ...T>
struct types { };

template <std::size_t ...I, typename ...T>
types<T...> slice_types(elt<I, T> const& ...);

struct x0; struct x1; struct x2; struct x3;

using Indexer = indexer<std::index_sequence<0, 1, 2, 3>, x0, x1, x2, x3>;
using Slice = decltype(slice_types<1, 2>(Indexer{},Indexer{}));
------------------------------------------------------------------------------

The error is

prog.cc:25:24: error: no matching function for call to 'slice_types'
using Slice = decltype(slice_types<1, 2>(Indexer{},Indexer{}));
                       ^~~~~~~~~~~~~~~~~
prog.cc:20:13: note: candidate template ignored: deduced type 'const elt<1UL,
x3> &' of 1st parameter does not match adjusted type 'Indexer' (aka
'indexer<std::__1::integer_sequence<unsigned long, 0, 1, 2, 3>, x0, x1, x2,
x3>') of argument [with I = <1, 2>, T = <x3, x3>]
types<T...> slice_types(elt<I, T> const& ...);
            ^
1 error generated.


It seems like the `T...` parameter pack is wrongly deduced to `x3, x3` in the
`slice_types` function. GCC accepts this code and does the right thing.

Live example: <a href="http://melpon.org/wandbox/permlink/5rsGlLeQbKgiLXqM">http://melpon.org/wandbox/permlink/5rsGlLeQbKgiLXqM</a></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>