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

    <tr>
        <th>Summary</th>
        <td>
            [clang++] Constructor "template<class U> T(U&&)" is better that copy constructor "T(const T&)"
        </td>
    </tr>

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

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

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

<pre>
    Example 
```cpp
#include <iostream>

class CLangTester {
 public:
    CLangTester()=default;
    CLangTester(const CLangTester&){
        std::cout << "Copy\n";
    };

    CLangTester(CLangTester&&){
        std::cout << "Move\n";
    };

    template<class U>
    CLangTester(U&&){
        std::cout << "Other\n";
    };
};

int main(){
    CLangTester c1;
    CLangTester c2(c1);
}
```
outputs "Other".
https://godbolt.org/z/5dP5vx8o3

But:
[[over.ics.ref/1.2](https://eel.is/c++draft/over.ics.ref#1.2)]

> When a parameter of type “reference to cv T” binds directly ([dcl.init.ref]) to an argument expression:
> [...]
>     -- Otherwise, if the type of the argument is possibly cv-qualified T, or if T is an array type of unknown bound with element type U and the argument has an array type of known bound whose element type is possibly cv-qualified U, the implicit conversion sequence is the identity conversion.
> [...]

and [[over.best.ics/general-example-2](https://eel.is/c++draft/over.best.ics#general-example-2)]

> A parameter of type A can be initialized from an argument of type const A[.](https://eel.is/c++draft/over.best.ics#general-6.sentence-5) The implicit conversion sequence for that case is the identity sequence; it contains no “conversion” from const A to A[.](https://eel.is/c++draft/over.best.ics#general-6.sentence-6)

and [[over.ics.scs/2](https://eel.is/c++draft/over.ics.scs#2)]
> a standard conversion sequence either is the Identity conversion by itself (that is, no conversion)

and [[over.ics.scs#tab:over.ics.scs-row-2](https://eel.is/c++draft/over.ics.scs#tab:over.ics.scs-row-2)]
> No conversions required

and this determines that `template<class U> CLangTester(U&&)` is not better than `CLangTester(const CLangTester&)`?
**expected** result is "ambiguous overload resolution"?
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy0VkuP6jgT_TVmUyIKNuGxYAE0SJ_0zWNBa9aOXSGecexc26Gb--tHldAN3ObOfWimhdSEVJ06deqUExmjOTrEFSs2rHgayS7VPqyirLyyo9Lr82r3KpvWIrB8zWb58FFtS5dcGKdspxGY2BofU0DZMLGje_laWRkjbP8v3fGAMWEANt-wfA1tV1qjmKAgALgNYXzB-JKJJ42V7GxiYvMwSHkX0_1vM0qcv4XTX0yaioi18l0iikxsgXG-9e2ZFVvHOL_is_nTcPGw3peVvr_YL_6E3yyWsGmtTMjEdlDteVDxI5HnHyz_W6ox_EP9GyLGJWikcZcZzB8oD2rycCKgOA1l0s_uDffGLyxf-y61XYpXTpxnLF_XKbWRmPM94_uj16W3KfPhyPj-M-P7Qv9enF4XXgwcN10afNP7deNPGDKjYhawYnw_yTgrnhhf3KMi2sxExveK8Q3jGx1klRjf32cLyuZLAuhLMbGDP2p0IKGVQTZIffoK0rlFYDvOFjlbbgNWGNAphORBneDwducJSuN0BG0CqmTPQLIWG61sZpxJfU3iuqRE6UCGY9egS4CvbcAYjXeXTsUOWLHJsuxCTez6iY_H0Av5YiIyvgVTQapxoOeH7--YJkLrYzSlPYM6jT910prKoIYDZfpAyQeK6okEeX6H6dxfzr84KH3nNLyYVANa7EH7kGeQTt8Xq-UDnDuU2ke8h_kqwWciSPCmaa1RJoHy7oSB9IGIn7peexOHGI0umXS-ickeKZivifSNhUqMiZxAFkSHQdoxDsfe-McddQUTH8G-MNj6gbfWoKSDEoF8YqQ1n1FDFXxzZ5O36OEkpH3I_g2msyyiSyTquCBzHr4lfeUDpFomUDJ-HMRbGBMbGACSNC6C89cVuqJed6dv99IaLch_0V9_iD5yAx0JsTfDzx0nfa64mbXYgYSYpNMy6IcqoqFVfpPvfx99DOUZTIpoKzpIesGJw5aUvBHwWx2JJEsm1rc_joN_-QmXfwfkbf-_3tKMEPBTZwLqK9tUmwiaFqExDuPg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