<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/59756>59756</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Function with two template template parameters is being ignored
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          bbastin
      </td>
    </tr>
</table>

<pre>
    When creating a function template that takes two template template parameters as well as a template parameter pack, clang states that the template does not fit. This behaviour is inconsistent with the behaviour of both gcc and msvc, both of which correctly select the template. I could not find anything in the standard that would prohibit using two template template parameters in a function template.

Example:

    #include <tuple>
    #include <vector>
    
    template <template <typename...> typename Tuple, typename... Targs>
    auto unmarshal() {
        Tuple<Targs...> ret;
        return ret;
    }

    template <template <typename> typename Array,
              template <typename...> typename Tuple, typename... Targs>
    auto unmarshal() {
 Array<Tuple<Targs...>> ret;
        return ret;
    }
    
 int main() {
        [[maybe_unused]] auto fields1 = unmarshal<std::tuple, unsigned, int>();
        [[maybe_unused]] auto fields2 = unmarshal<std::vector, std::tuple, unsigned, int>();
 }


Error using clang trunk:

    <source>:19:37: error: no matching function for call to 'unmarshal'
        [[maybe_unused]] auto fields2 = unmarshal<std::vector, std::tuple, unsigned, int>();
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    <source>:5:6: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'Targs'
    auto unmarshal() {
         ^
 <source>:12:6: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'Array'
    auto unmarshal() {
 ^
    1 error generated.

Example in Compiler Explorer: https://godbolt.org/z/ME6qx5jWE

The same error occurs on my local machine running clang 14.0.6.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMVk9v47gP_TTKhRjDkeOkOeSQ5g_wO_xuBea4oCXG1lSWvBLdNHvYz76QnbZJ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