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

    <tr>
        <th>Summary</th>
        <td>
            The function call should be ambiguous if the partial ordering succeeds in both directions but the length of template parameters differs.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

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

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

<pre>
    ````cpp
#include <iostream>
struct Test{
    using type = void;
};
template<class T>
struct Void_t{
    using type = void;
};
template<class T>  // #1
concept HasType = requires(T a){
    typename T::type;
};
template<HasType T, class U = T>  // #2
void fun(T){ 
    std::cout<<"#1";
}
template<class T>
void fun(T){
 std::cout<<"#2";
}

int main(){
 fun(Test{});
}
````

The call of `fun` should be ambiguous according to [over.match.best.general] p2.5 and [temp.func.order] p6
> If deduction against the other template succeeds for both transformed templates, **constraints can be considered as follows**: 
>> - If **their template-parameter-lists** (possibly including template-parameters invented for an abbreviated function template ([dcl.fct])) or function parameter lists **differ in length**, **neither template is more specialized than the other**.

In this example, deduction against the other template succeeds for both transformed templates but `#1` and `#2` differ in their length of template parameters, therefore neither template is more specialized than the other. Hence, the call should be ambiguous. GCC rejects this example, but Clang accepts it and considers `#1` as the best viable one. https://godbolt.org/z/r8r1Gjfbn

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVV2vmzgQ_TXOy-giYkIIDzzcmzRt37P7ujL2EFwZm7VNtu2vXw3mkvvRbqVVJZQE23PmnJkzjghBXy1iw8onVp42Yoq9883Xoc_L7XbTOvWtYft8feQ4svzE8kfGC22lmRQCK47ahehRDKz4kLZD9JOMcMEQWfWU1gAApqDtFeK3kcJOcHNasWLZZ9Vp_R1xGI2IyIqjNCIEuLyF_tNp9ddvBAdg_Mz4GRgvtumcdFbiGOGTCJdnUI9_T9pjYPxwAcF4_YoB5bZi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