<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 --- - &quot;failed template argument deduction&quot; with function pointers and multiple parameter packs" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23949&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=H0kFfT-LOrqQ_J9-g5W7D7I5cwQFfgmg-2Q3PNo_MGQ&s=r0gmKS4KP-6xTmWHEFCshbhMBgxTq3mb8wuhgrE7pcM&e=">23949</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>"failed template argument deduction" with function pointers and multiple parameter packs
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </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++11
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>michael@ensslin.cc
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Take this example:

$ cat t28.cpp
template<class ... Ts>
struct S {
    template<class ... Us>
    void foo(void (*)(Us..., Ts ...)) {}
};

void f(float, int) {}

int main() {
    S<int>().foo<float>(f);
}

$ clang++-3.7 -std=c++14 t28.cpp
t28.cpp:10:11: error: no matching member function for call to 'foo'
        S<int>().foo<float>(f);
        ~~~~~~~~~^~~~~~~~~~
t28.cpp:4:7: note: candidate template ignored: failed template argument
deduction
        void foo(void (*)(Us..., Ts ...)) {}
             ^
1 error generated.

$ clang++-3.7 --version
Debian clang version 3.7.0-svn239806-1+b1 (trunk) (based on LLVM 3.7.0)
Target: x86_64-pc-linux-gnu
Thread model: posix

Note that g++ has this issue as well, but it supposedly works with MSVC.

The issue can be fixed by swapping the order of Us... and Ts... in the function
pointer type, or by replacing the function pointer type by some other type like
std::tuple.

Related: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__stackoverflow.com_questions_31040075&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=H0kFfT-LOrqQ_J9-g5W7D7I5cwQFfgmg-2Q3PNo_MGQ&s=B_JaYdMeaXShG9rrYu2JBXLh2WUsY_u-fHGRGMZNGaA&e=">http://stackoverflow.com/questions/31040075</a>

g++ error, for completeness:

$ g++-4.9 -std=c++14 t28.cpp
t28.cpp: In function ‘int main()’:
t28.cpp:10:23: error: no matching function for call to ‘S<int>::foo(void
(&)(float, int))’
  S<int>().foo<float>(f);
                       ^
t28.cpp:10:23: note: candidate is:
t28.cpp:4:7: note: template<class ... Us> void S<Ts>::foo(void (*)(Us ..., Ts
...)) [with Us = {Us ...}; Ts = {int}]
  void foo(void (*)(Us..., Ts ...)) {}
       ^
t28.cpp:4:7: note:   template argument deduction/substitution failed:
t28.cpp:10:23: note:   mismatched types ‘int’ and ‘float’
  S<int>().foo<float>(f);
                       ^
$ g++-4.9 --version
g++-4.9 (Debian 4.9.2-22) 4.9.2</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>