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

    <tr>
        <th>Summary</th>
        <td>
            Concepts constraint checking doesn't respect the standard
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          andrei-edward-popa
      </td>
    </tr>
</table>

<pre>
    Consider the following code:

    #include <type_traits>
    
    struct S {
        template <typename T> explicit S(T) noexcept requires std::is_signed<T>::value {
            std::cout << "T\n";
        }
        template<typename T> explicit S(const T&) noexcept {
            std::cout << "const T&\n";
        }
    };
    
    int main() {
        S s(4);
    }

This code compiles successfully on clang-15. The problem is that this constructor call need to be ambiguous according to http://eel.is/c++draft/temp.func.order#6 on point 6.2.2.

Note that in this case, the stripping of references and cv-qualifiers doesn't apply, because that is only done as part of deduction, and we're not doing deduction anymore, so the function parameters types that positionally correspond are T and const T&, which are not the same. Therefore, neither template is more specialized than the other, meaning that the final tie-breaker must fail to prefer one overload over the other.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVVMuy2jAM_Zqw8ZAJDoHLIouW2y67KfuOYyvErWO7flxKv76S4QJ9TKeFjBNH1tGRdJTBqXO_dzZqBYGlCdjojHEnbY9MOgVV-6ZqnqvmujL8VbzVVpqsgFXtPp09fEpB6BSr9t3DqdtTTCHLxD6yavv2_pZ-CWZvRLrhWDEDOyAMg2_eaKnRq-JPh4rvmHXwTYJPLMDXrANExFXErn2j46eojxZwuyfvy9sXYTL8HvPC6OopXU4UHC9Mix-qbm_xXrW_OFXb5z8z_ztxiXVN-J5vfsrgvzg9YPwLOdo8Hrg_aZvYLDRCPBGb30h8ZBFNa7T9DPCKflkPk45FGLjMXhvqQ5YSYhyzMWfmLJNG2ONy1dXsgHLywQ0GZoZuaRIJlwJgL6pwgUlhDLMA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