<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62121>62121</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
-Wundefined-var-template could use fixits
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ben-craig
</td>
</tr>
</table>
<pre>
The syntax for explicitly instantiating a template declaration is not easy to guess. In addition, this is a warning that users are likely to get when migrating from gcc or msvc, so the "fixer" of this warning is very likely to be different than the originator of the code. So we should help them out as much as we can.
This may want to even include _multiple_ fixits, to cover the varying use cases.
So if we have code like the following:
```
template <typename T>
struct has_static {
static std::string my_str;
};
```
Then we may want one fixit for the "generic" case `template <typename T> std::string has_static<T>::my_str;`.
And another for the explicitly instantiated in a .cpp file case `template <> std::string has_static<int>::my_str;`.
Then there's yet another syntax, which I can't recall the pros / cons for: `extern template std::string has_static<int>::my_str;`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyclEGPqzgMxz9NerFa0dDCzIHDvJmt9M5vpD2OQjDg3ZCg2JTy7VeB7nRH-1ZPWqlqADt__2zHMczUecRKnb-p89vOTNKHWNXo9zYa6nZ1aJbqvUfgxYu5QRsi4G10ZEncAuRZjBcyQr4DA4LD6IwgNGidiUYoeCAGHwTQ8AISoJuQ-QDw3YNpGkouSr-C9MTJ1cBsok9y0huBiTEymIjg6E90mwIKzD16GKiLW-g2hgE6ayFEGPhqkyIHkB5Bad3SDaPSGkK7xfk7BDFcMS7_0K4RGmpbjOglEfhVI0TqyBsJcZNAsKHBA8CPADMC92FyDfToxmQcIEwChmGYbJ_WGcEaf1DZm8petv_3hDGYBWaTAgXAK3ogb93UIHwMkxMaHX5ASzcSXisUwIYrxjX-1cQlZTBx0mbkL-o_AlCbwvbmurGuKa472-BcmMl3Kr97qyK7_9bXzyaq_FWWEb0ZEN5V_ttmZomTFegNf7AYIQuq_LaZAADu31iapJ8n98Q5LB8sUeV3T1W-PZ6_hn9PnZ3xUZzgcavCevruLe3QYySbmprSB1Vk_8n9L5gHu8pf18xW64OxyL6U88U3YHyQHuMnw0-nABsgDwYOdhyhJYc_hfslEnn5NdRap4SESpcMC8on4zas6czMPdkevqfjp3QpENEa59YExhgYlL6ADZ5TWip_SaR4E4z-Mcr_j3TXVHnznD-bHVbH4ul4Op7PZbHrK1tkWGhdnM3TsTT6VOd5e8RSN_kps0Wmd1TpTOfZ6Zgfn8_6XBya5_pcl2V9zp_KPD9ZdcpwMOQOzl2HQ4jdjpgnrAp91MedMzU6Xi80rT3OsBqV1ul-i1Xas6-njtUpc8TCDxUhcVjtf598gy15bPZXE_efdbDrjKd520ZyN0VX9SIjp_T1RelLR9JP9cGGQelL0r0v-zGGP9CK0peVhpW-rLR_BQAA___-fs1w">