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

    <tr>
        <th>Summary</th>
        <td>
            Out-of-line explicit instantiation of templated constructor of templated class fails
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    It seems impossible to explicitly instantiate a templated constructor of a templated class: `error: out-of-line constructor for 'S' cannot have template arguments`. It works fine for a member function.

https://godbolt.org/z/1P9Kcojjf

```c++
template <bool B>
struct S {
    template <bool C>
    S();
    template <bool D>
    void foo();
};

// <source>:11:10: error: out-of-line constructor for 'S' cannot have template arguments
//    11 | S<true>::S<false>(){}
//       |          ^~~~~~~~
// <source>:11:10: error: no function template matches function template specialization 'S'
// <source>:4:5: note: candidate template ignored: couldn't infer template argument 'C'
//     4 |     S();
//       | ^
template<>
template<>
S<true>::S<false>(){}

// OK
template<>
template<>
void S<true>::foo<false>(){}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVMuO6ygQ_ZryppTIBj_ihRd5dKSru7gj5QswhoQeDBHg3OlezLePsNN59rTU0kUWoCqfOlVQHOa92hshGihWUGwSNoSDdY1RwQjNTiJpbffW_Ajoheg9qv5ovVetFhgsin-OWnEV9Bsq4wMzQbEgkGEQ_VGzIDrk1vjgBh6sQyvvXZp5D3SJUKbCOevi3g5hZuVMKyPusNI6BFLtgFTImTE24IGdxCUcMrcfemGChzKd44-Av63726OMgSKYYS_6VjiUg-FBWTOHdAPpcpoPIRxjLkC2QLZ727VWh7l1eyDbdyDb7K_6J7evr_IWBGU6fRzIKn6j9ZIR0HVrrcYV0JfJNVWDO4Tq_DMi4hNgfQFE9w7IAkgN9CvI5g5ysqpDae0DEqrNdT_NY7kxireD4yJGocssi1Mar-NP3sstIyJmGUK1xh3QdXDDmRroMhok0360TAVUq5j6Ax5xxF8GFC__TuO7tRl7aYpr3j0L_CD8Jx5_FFwxrd7ZaD9X_xVpDnRZTExBxJUz06kuBrtEVXtjnehGrx10Z4BUAZWRwj0fZiRdP5LGkV_O5LFtng4Oipf7hgV6bbzPbN-9qVvaXz-_xzV28BNhbOkvKT8eZNI1tKtpzRLRZOWiTIt8sciSQyMX9SKltCaS8iynBWtL0vGsoG1Wp5LliWpISmhapmVGaJ5nc1pzSau6WhBWiy6VkKeiZ0rPtT71USES5f0gmpJmeZ5o1grtRzElxIjfODqBkKitromYWTvsPeSpVj74a5SgghbNr5tn9qGuN9oa-83K_5fXB3FFyZT2yeB08yBwKhyGds5tD2QbUzgvs6Ozr4IHINsxcQ9kOxb2XwAAAP__RJDVdQ">