<html>
    <head>
      <base href="http://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 --- - Error when explicitly specify template parameters for variadic template function that uses variadic arguments in return type specification"
   href="http://llvm.org/bugs/show_bug.cgi?id=22588">22588</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Error when explicitly specify template parameters for variadic template function that uses variadic arguments in return type specification
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.5
          </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>yyc1992@gmail.com
          </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>Created <span class=""><a href="attachment.cgi?id=13864" name="attach_13864" title="source file">attachment 13864</a> <a href="attachment.cgi?id=13864&action=edit" title="source file">[details]</a></span>
source file

Might be related to 22191 but at least the symptom is different.

Source file that produces the error (Also attached).

```
#include <utility>
#include <functional>

template<typename Func, typename... Args>
static inline auto
caller(Func &&func, Args&&... args)
    -> decltype(func(std::forward<Args>(args)...))
// Changes to `-> void` suppresses the error
{
    return func(std::forward<Args>(args)...);
}

template<typename Func, typename... Args>
static inline auto
wrapper(Func &&func, Args&&... args)
    -> decltype(caller(std::forward<Func>(func),
                       std::forward<Args>(args)...))
{
    return caller<Func, Args...>(std::forward<Func>(func),
                                 std::forward<Args>(args)...);
}

int
main()
{
    wrapper([] () {}); // OK
    wrapper([] (void*) {}, nullptr); // Error on Clang 3.5.1
    return 0;
}
```

Error message produced on Clang 3.5.1
```
main2.cpp:18:12: error: no matching function for call to 'caller'
    return caller<Func, Args...>(std::forward<Func>(func),
           ^~~~~~~~~~~~~~~~~~~~~
main2.cpp:26:5: note: in instantiation of function template specialization
      'wrapper<(lambda at main2.cpp:26:13), nullptr_t>' requested here
    wrapper([] (void*) {}, nullptr);
    ^
main2.cpp:6:1: note: candidate template ignored: substitution failure [with
Func =
      (lambda at main2.cpp:26:13), Args = <nullptr_t>]: pack expansion contains
      parameter packs 'Args' and 'args' that have different lengths (1 vs. 2)
caller(Func &&func, Args&&... args)
^
1 error generated.
```

GCC 4.9.2 compiles it without an error.</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>