<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/87235>87235</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang rejects valid out of class definition of a static const data member as constexpr
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ranaanoop
</td>
</tr>
</table>
<pre>
Consider the following program and the comments given in there:
```
template<class T>
class C
{
public:
static const double mem;
static const int k;
};
template<class T>
constexpr double C<T>::mem{};
template<class T>
constexpr int C<T>::k{};
int main()
{
constexpr double i = C<double>::mem; //#1: gcc accepts but both clang and msvc rejcects
constexpr int j = C<double>::k; //#2: gcc and clang accepts but msvc rejects
}
```
As you can see clang accepts `2`([demo](https://godbolt.org/z/68xdvGrex)) but rejects `#1`([demo](https://godbolt.org/z/KvTfKzrMe))
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyclM1y6ygQhZ8GbbrikkBY1kIL_4xnkZpdXgBBWyZBoALkSfL0U2A7jj25i3tdKrvcNOd8HAEiBD1YxI7wDeG7Qszx6HznhRXCOjcVvVMf3dbZoBV6iEeEgzPG_avtAJN3gxcjCKvyiHTjiDYGGPQJLWibqh4JW5NyR8rr97K8PPlvxHEyIiJhW2lECPBC2F8A58FzZXuZ2GwuZQCAae6Nll_aEKKIWoJ0NkRQbu4NwogjYRuAb9Py565X25hqb6nzarQjbPOd-WfIC2NSwffJX123hG3TeGJj68TQbM6S8Puaie5e8O1RLrWMQltCV4S2X1nd1vw_Qg1A2C7rnit3tEmY7vPDKsLWMEgJQkqcYoB-jtC7eARphB3yqx_DSYLHV4kyhp9cLwm__tL17c6TfnladbX55n61u7mRZgc_7q11gA83gxQWAuKDFlmWNHXSFeEbhaMjfEfo6hjjFBJWxhmc6p2JC-cHQvefhO6Xq3d1-tvje8qathnpQgNZjlV_oPp8ejk8f_p_8KxaqI6plrWiwK5qqqptOGdNceyqVrGqLJeKK04Vp0hFo3hbq7YvuWRtoTta0rqsy6qiNWf1Qiyrtk4aqMRKNpzUJY5Cm4UxpzERFDqEGbtVQxkvjOjRhHwbUJrzIpSmi8F3qf-pn4dA6tLoEMNNIeposNvmeK9ZnITRCtwcwR3gvMEVHrTVUTubauLhyIoo0oHt0YMIt91TzN50D_HpeJz7hXQjofsEcfl5mrxL5oTu85oCofu8rP8CAAD__9TVeAU">