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

    <tr>
        <th>Summary</th>
        <td>
            clang incorrectly judges default copy constructor in template class
        </td>
    </tr>

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

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

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

<pre>
    Consider the following code:

```c++
template<typename T>
class Box
{
public:
  Box(const Box<int>&)=default;
  //Box(const Box<T>&)=default;
};
```

The constructor of class `Box` in line 5 should be a normal user-defined constructor instead of a copy constructor as the parameter list is incompatible(the real copy ctor should be in the form of that in line 6), so it should not be declared as defaulted. Both GCC and MSVC reject the code, but clang accepts it.

MSVC provides the following diagnostic:

```c++
example.cpp
<source>(6): error C2610: 'Box<T>::Box(const Box<int> &)': is not a special member function or comparison operator which can be defaulted
<source>(6): note: the template instantiation context (the oldest one first) is
<source>(3): note: while compiling class template 'Box'
Compiler returned: 2
```

Please see [https://godbolt.org/z/EbY3zWKc1](https://godbolt.org/z/EbY3zWKc1)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVE2P4zYM_TXKhZjAoZM4PvgwcTY9FAWKdtCiR1miYy1kyZDo-dhfX0hxZmZn28ECRuIP8pF8fE8yRnNxRI3YHcXutJIzDz40f8xx2BRYlqvO65em9S4aTQF4IOi9tf7JuAsor0mU96I4ieL2uy-ulxJ4TFd-yzROVjKJsuWXiZwcCR5E-eX6VVkZIxz98wJRLVnT3FmjXgtADsGD8i5yvi9b4zjB4F5gLcqTpl7OlkV5vKUIPAs8_5j48FmaqE5v97eB3k_5MBBktDAr9gF8D9chxL5I-PsCjANrHMEO4uBnq6EjkOB8GKWFOVK409QbR_o7IOMik9QJUILy08t3X2XMC5hkkCMxBbAmMpgIxik_TpJNZ0ngIQUFknZBSKlvTRi3bDGMqQwPkl-bzXxgC9GD4VuO85zyNCkrA-nUxUIY6TUcPQ_wS9uCdBp--_OvFgJ9JcW5SBYIttDNnAhyF5BK0cQRDK_fE5oTp-Afjab4QWXayIvzkd9J4TOt0bMcJ0trNU1LWNlGPwdFeeWH687vgULwAVrcb4r0KLB6p4zyXpT3_yc3WISDVUo0MTMkIU6kjLQw0thRgH52io134APk7QQT09NEQaaNPA1GDaCku5K7EPppy84nC91nfm6WypKRjo3MxZR3TM8Miwq81RQZvCPoTYgssAYT_7NI-aHI02As5c6NzWbPAn8tu_CF1RWszXEUIBDPwZFOEPiJhX63JCNBJAKxOw7MU0ysZ7tevO685bUPF4HnbwLPX7p_ym9__6o2YncSePj5cKxXuil1XdZyRc2mws12f6j329XQqN2mL3ql1Eb1muSuoBJrWeHuUKgSu25lGixwW1RYFPW2xu0aN1TWdVd0qjjoXu3FtqBRGru29nFM5Vcmxpmauq629crKjmzMBytiVr9ATGdsaFL8XTdfotgWycPxDYENW2quZkm2DoEU2xf4OusLvTrvx7Mh2fq2m7yq1Rxs84Eow8PcrZUfBZ5TxeXvbgo-eVbgOQ8QBZ6vMzw2-G8AAAD__wbX7I8">