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

    <tr>
        <th>Summary</th>
        <td>
            Clang allows template constructor to have different template argument list with that of class definition with default argument
        </td>
    </tr>

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

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

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

<pre>
    The following invalid code is not rejected by clang for incompatible template parameter list between ctor and class definition:

```c++
template <class TClass, int NON=0> 
class T 

public: 
  T<TClass>(int f) {}
}; 

int main(){
    T<int> t(10);
}
```

EDG and GCC reject it. The diagnostic of GCC is weird though.

EDG rejects it with the following diagnostic, which seems more reasonable.

```c++
"<source>", line 5: error: type used as constructor name does not match type "T<TClass, NON>"
 T<TClass>(int f) {}
    ^

1 error detected in the compilation of "<source>".
```

Please see https://godbolt.org/z/s3KK85qxo
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMU8GO4zYM_Rr6QmwgS8nEOfiQOJM9LLDtYX5AtmhbhSylEp10-vWF7HQz3UGBBQRItvieyMdHnZIdPFENuxPszoWeeQyxvms_tKHcFW0w7_XbSNgH58Ld-gGtv2lnDXbBENqEPjBG-oM6JoPtO3ZO-wH7ENH6LkxXzbZ1hEzT1WkmvOqoJ2KK6GxibInvRB47DhG1NxmfEhrqrbdsgwd1BLGsF7GuDuQpL3H8QQqqWXFvTd5ANmg94_ffvoM6C1CvCOL4iMhH2J_ydp1bZztQx_yB-AaqeRCoV5BVpuhBHhD2J9ifF9wZ1AIFcczXk7YeZAXykGMyyUpjPedXGWRVinyrTg_4h0JWmtfz16Xwr03zEBItbzCrbqwefEhsOwz9EmAT3slGgzyGeRg3T4oVmtAy3i2PyP_p2pMpa3MfbTdiIpoSTiESRtIpeN062vyv2CAlqCaFOXa06CMzlbOecJclpBhDzAd-vxLOiQzqhF3wieO8tNfridAEWk0zae7GNRik_KC9bNbGLU-I4y-0JasOu9c19XLNBA3xakrrFzGyGa3T2VNZzc_lbD735ndHOlFWCkfma8pmlBeQlyGYNjjehDiAvPwN8pLUt2_V7s-_QmFqZQ7qoAuqy716kbIsq20x1iREaURFrelftlK87Mu-arVWqmwliYoKW0shd6IUe6HUYbvdmF5qWYpdKQ_7vlItbAVN2rqNc7cpv13YlGaqS1lWlSycbsmlf2c51jnqSzsPCbYiD1t64tiyo7pZZlVnk6TnhH5sGQcc9S07se8pkudnmI7DPOU_yxw_PKc5a_vzDK-3hno9O_4BLObo6p9ktTzO7aYLE8hLTvaxfbnGkO0N8rJUnEBeHkXfavlPAAAA___4wX5e">