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

    <tr>
        <th>Summary</th>
        <td>
            [Clang][C23] Possible bug in initialization of constexpr variable
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            c23,
            clang:frontend
      </td>
    </tr>

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

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

<pre>
    Consider the following code
```
void f(){}

const int x = 4;

constexpr auto a = x - x; //clang: error: constexpr variable 'a' must be initialized by a constant expression
constexpr auto b = &f - &f; // clang accepts

```
but trunk gcc rejects both constexpr variables with the same diagnostic
```
error: â€˜constexpr’ integer initializer is not an integer constant expression
```
So i guess that clang should also reject the initialization of the 2nd constexpr variable
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0k91u6ygQx59mfDNKZIM_L3zRNJvrlfYJMBCbLYGIGafpPv3Krk9a9eRIlhkY5uP_06CI3Bis7aE6QHXM1MxTTL2eLHH4eJuyIZqP_jUGcsYm5MniOXof310YUUdjIT9C_gJ1vn3r9hadwTOIFkQHzQGa43Zt_esYiNEFxjuCPGIJ8vCb396vCdXMEdV66Y47vIM8IIgTiJP2KowgX9CmFNNifEXdVHJq8BZBNApEg5eZGAeLLjh2yrv_rMHhA9VnjAqMS5wlcjE8bWFYWwBRn3G3Ll-N4NoJKq3tlem7jB9MhpmR0xzecNQak_3XaiYcIk9PWid8dzytuEldLBqnxhCJnX6a-wEB_hLQ5tC1j5S_TroFuB1t-kYhoSMMkVGFh_ePSH6U_Ceiw3G2RMiT4g0DTXH2BpWnuElcNTxKKnYxYDyvpyKYJ9Iz00vTyU5lti8aWZR51bR1NvWVbIva6NrUtVJNWeWlUpWU51w2hRnsOXO9yEVZFIUo8lzm9X6QRquyVUXVic50LZS5vSjn997fLvuYxswRzbYviqotq8yrwXpaX4IQWkgQAsTrYm_Ddk4xsA1mcVTHLPVLnt0wjwRl7h0xfWVmx359Va9rcHVcTCGhOuLfkcgt8znMI7rwhM4TKnPy_cR8JZAvn5M3Op7mYa_jBcRpqbstu2uKC3kQp1UegThtCm-9-D8AAP__FBk_aA">