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

    <tr>
        <th>Summary</th>
        <td>
            clang rejects specialization of template constructor
        </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>
    The following code is rejected by clang:

```c++
struct A
{
 template<typename T> A(T);
};
//Error
template<> A::A<int>(int) {}
//OK
//template<> A::A(int) {}
```

The diagnostic says that:

```c++
<source>:7:15: error: qualified reference to 'A' is a constructor name rather than a type in this context
    7 | template<> A::A<int>(int) {}
      |               ^
<source>:7:16: error: expected unqualified-id
    7 | template<> A::A<int>(int) {}
      | ^
2 errors generated.
Compiler returned: 1
```
It seems the compiler does not correctly understand the statement as a template function specialization definition.

Note that the error will not appear if the template argument is implicitly specified in the form of `template<> A::A(int) {}`.

[https://godbolt.org/z/d68xffvdf](https://godbolt.org/z/d68xffvdf)


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVN2O6yYQfhp8M9oIQ2zHF77I5keqKrVStS-AYWxTYXAB79mcp68gyW726BxpVdVCCcYz833zzTAiBD1axI5Uz6Q6FmKNk_PdX2uYSso4L3qnLt3LhDA4Y9w3bUeQTiHoAB7_RhlRQX8BaYQdCd8TeiT0_lvT65KEPaeVT0P0q4xwt2luxxBxXoyISPghXha0YkZ4IfwEe8J2L4S1hD_ffY4fe3Ym7Hzy3vnrwUOYqzNPa0_4QdtI-ImwXdqwFhJ0c3wM8-fvj2-_ivTzAPdcHwVIsiktRutC1BKCuASIk4hf0onwQ3Crl5hI831D-L6sCN8D5mT5Hv5ZhdGDRgUeB_RoJUJ0QFizJ6xJFRIgnb0K7jxkSb2IE_pEw4KApDRoC3HSIdlGfIu3egBAA6Q5wH9TFPKT_D8_pDr9Or_6U374tlz7a7XvqT5p9X_ze2fErtABRrToRUS1uX44uHnRBj14jKu3qBK78qeF_y1CQJxTnRHk3U85DGBdBOm8RxnNBVar0IcorMqmIYqIM9oIIpXtnhMMq5VROwthQamF0d9FflU4aKvTdvPYSn-4iLnFctCcDnzTxmRwsSwoPOghf3yHEH5cM7IOoOfFaKkTwQyYuyv3RxoAfgY3AKnpV69GTT-xI9XzFOMSknm-YqNTvTNx4_xI2Pk7YWdV796G4VUNpDoStvu6OWsfkQrVcdXyVhTYlQ1jddOW26qYOl7WCrdY9S1TTdlssZSslPUg6W7Xsr4sdMco29Id5bStWlpttg2nkg4tlb3igg5kS3EW2myMeZ0TlUKHsGJX0nJH68KIHk3I45Sx61RkLE1W3yWHp34dA9lSo0MMHyGijga7bH4bq-HHirvho2QPt7pYvel-kEnHae030s2EnRPE7e9p8S6FJuycKQfCzjfWrx37NwAA__8_G8sK">