<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/59514>59514</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] Initialise static in templated class
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Ignition
</td>
</tr>
</table>
<pre>
```cpp
//template definition
template<typename T>
struct S
{
static int thing;
};
// extern template instantiation
extern template struct S<double>;
// in .cpp
// template instantiation
template struct S<double>;
// initialise the static storage
template<> int S<double>::thing = 42;
```
Works in GCC and MSVC [godbolt](https://godbolt.org/z/TjEc6vqWT)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUkk9vnDAQxT_NcLGyMubfcuCQXUKVQ09ZNWdjz4JTr03xkDb99BWwf6KtVKkSwpbGfr_nNyNDMJ1DrCDbQVZHcqLej9Vz5wwZ76LW648Kcr5-ahiA18AfQTQgGsLTYCUh03g064W1fClAsqePAZ08ITtA8rRWA42TIvZylip264YxxgJJMooZR4x64zpIdpdT9W2_wBn-Ihwdu5owLpB0ZOTNx_2RKznZaz-1FmdPV9nP_xVhHNvcvfmfvP8CXRCGjLQmIKMeLwEE8qPs8K80IXlawrkTfoTkccmLQVKzVNxQl859Jr_68XuY3_Zlv2fSafb15dueQbbrvG69JchqENueaAiz9OLzXNr4sQPR_AbRHN6eVP7-4_UAoox0legyKWWEVZwXMY9TnsVRX-Xb4ljwIm_zI25TpbEQedHyHONSaZXxyFSCCxGLOI15ksbxRufFtiwUZslWtKrMIOV4ksZurH0_zfjIhDBhlZVZnEZWtmjDMrxCOPzJliIIMc_yWM13HtqpC5ByawKFmwoZssvUKytdB1nNnm-duI7htduaKStDiKbRVnfJGOqndqP8CUQzy5-Xh2H0b6gIRLOYCiCaxfSfAAAA__9Tzg3B">