<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Parameter pack not expanded in typedef for function type"
   href="https://bugs.llvm.org/show_bug.cgi?id=46377">46377</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Parameter pack not expanded in typedef for function type
          </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++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>zilla@kayari.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>template<typename T, typename U>
struct require_same;

template<typename T> struct require_same<T,T>
{ };

template<typename T> using int_t = int;

void (*f)();

template<typename ...Ts>
void g(Ts... args) {

  // This works
  ((void (*)(int_t<Ts>...)) f)(args...);

  // This works
  using funcptr = void (*)(decltype((void)args, 0)...);
  ((funcptr) f)(args...);

  // This is wrong
  using funcptr2 = void (*)(int_t<Ts>...);
  // The type funcptr2 only has a single parameter, pack not expanded
  require_same<funcptr, funcptr2> chk;

  // So this fails
  ((funcptr2) f)(args...);
}

void h(int x, int y) { g(x, y); }


This works with Clang 3.0 but fails with anything later. This prevents building
GCC master with Clang.

var.cc:24:35: error: implicit instantiation of undefined template
'require_same<void (*)(int, int), void (*)(int)>'
  require_same<funcptr, funcptr2> chk;
                                  ^
var.cc:30:24: note: in instantiation of function template specialization
'g<int, int>' requested here
void h(int x, int y) { g(x, y); }
                       ^
var.cc:2:8: note: template is declared here
struct require_same;
       ^
var.cc:27:18: error: too many arguments to function call, expected 1, have 2
  ((funcptr2) f)(args...);
  ~~~~~~~~~~~~~~ ^~~~
2 errors generated.</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>