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

    <tr>
        <th>Summary</th>
        <td>
            clang doesn't respect partial ordering of templates with parameter packs, reports them as ambiguous
        </td>
    </tr>

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

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

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

<pre>
        #include <tuple>
    
    struct Q{};
    
    using TUP = std::tuple<Q>;
    
    
    template<typename Fn>
    inline
    void feh(Fn&, const std::tuple<>*)
    {}
    
    template<typename Fn, typename H>
    inline
    void feh(Fn& fn, const std::tuple<H>*)
    {
        fn(H{});
    }
    
    template<typename  Fn, typename H, typename... R>
    inline
    void feh(Fn& fn, const std::tuple<H, R...>*)
    {
        fn(H{});
        using Rest = const std::tuple<R...>*;
        feh<Fn, R...>(fn, static_cast<Rest>(nullptr));
    }
    
    template<typename Tuple, typename Fn>
    inline
    void fe(Fn& fn, const Tuple  *  tpl =  nullptr)
    {
        feh(fn, tpl);
    }
    
    int main()
    {
        auto r = [] (Q const&) {};
        TUP tup;
        fe<TUP>(r, &tup);
    }

GCC 8.2 (and 12.1) compiles the code just fine. However, clang 11.0.0 (and 14.0.0) complains  that the call from `fe` to `feh` is ambiguous between `void feh(Fn& fn, const std::tuple<H>*)  [with Fn = (lambda at <source>:38:14), H = Q]` and `void feh(Fn& fn, const std::tuple<H, R...>*) [with Fn = (lambda at <source>:38:14), H = Q, R = <>]`.


<https://godbolt.org/z/5E9M6a5c6>

Discussion at <https://stackoverflow.com/q/72658026>.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJytVcFymzAQ_Rq4aMqAMBgOHBKS1JfONJn03JElYSuREZVEPOnXd1e4tpM4mTQpY4PWWt6-fbtaL414bAhcEc1Vz_UoJIny1o-DllF-GaUX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