<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/121924>121924</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>
clang
</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 an 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 somewhat 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/eJx8U92uozYQfprhZrQR2CGBCy4ScrIXK217cV7A4AFcGTu1h6SnT18Zos3prlrJkkk889nz_agYzeiIGijPUF4ytfDkQ_NQbux8UWad1x_N-0Q4eGv9w7gRjbsrazT2XhOaiM4zBvqDeiaN3Qf2VrkRBx9QOTSu9_NNseksIdN8s4oJbyqomZgCWhMZO-IHkcOe1yadIGJETYNxho13IE-Qr-uQb6sHcU4rP_0ABdlufe9t2kC0aBzj99--g7zkIN8Q8tOzIn3C8Zy229JZ04M8pR-I7yDbJ4B8A1EliAFEjXA8w_Gy9l1Arq2Qn9LxrIwDUYGoU00C2WCM43Qrg6iKPJ3K87P90yAbzNvl6zr417Z9comGd5iI10aNzkc2PfphLTARo5_pMSnGB5mgkSe_jNPuhbVhRDSMD8MT8r8UfEEmkh6T6SeMRHPE2QfCQCp6pzpLu_9kHYQA2Ua_hJ5WokSCssYRlolLCsGH9MEfN8IlkkYVsfcuclhWnZ2aCbWnzUCz4n7aikGITyKIdlNwveLF7f9LlKqgfNteX2yPQU28edS4lY9kTGNV8ldi9teJdr_q9LslFSmRhRPzLSZjiiuI6-h15y3vfBhBXP8GcY3y27eq_PMvn-lG6lrWKqOmOMqDKOW-LrOpkQPtpSzVoe_2uqJcdaXo-zyvj7qXuThkphG5KPMiPxZCVoXcVao8kKirQ3esq2qoYZ_TrIzdWXuf092ZiXGhphBFLfaZVR3ZuEZbiDWWacjykoUmNXzpljHCPk8ZjC8INmypadcUq2SZ-AruZwHZ46TuyaDDQIEcv8pUGJc5_bPG--lAxYnmn6O9nWoa1GL5R2O2BNv8xLDhael2vZ9BXNNjn9uXW_DJ7CCu6_ARxPU5_70R_wQAAP__7aSGfg">