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

    <tr>
        <th>Summary</th>
        <td>
            Pointer to thread_local variable accepted in a constant expression 
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

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

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

<pre>
    The following program is accepted despite constant expression `b` includes evaluation of a pointer to `thread_local` variable:
```
constexpr thread_local int a = 0;
constexpr int b = *&a;
```

A similar problem seems to exist in GCC, and only MSVC properly rejects the code. Only demo: https://gcc.godbolt.org/z/TxK7KKnPE
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsks-O2yAQxp8GX0ZrYXCc-OBDNlv3sKq6Ule9VoOZ2FQYLMBp0qevSHebNqpkGaH5Dd_8-TBGMzqijm0e2eapwDVNPnQ96VAory_d60Rw9Nb6H8aNsAQ_BpzBRMBhoCWRBk1xMYlg8C4mdAnovASK0XgHrOGKNRyMG-yqKQKd0K6YcswfAWHxxiUKkHxm0xQI9TfrB7Q57YTBoLLE5J7xJ8b3rOFv3_V6lcxy8HcmGJcAgckn4Ew-3qM5qq5RJvZMNPiHuXv9938P0czGYsjNK0szRKI55orpbGIC4-Dj4cDEAdBp8M5e4NOXr4eMLxTsBQJ9pyFFSFMekqYSPmdI0-yZ3MOU0hJzh6Jnoh-HoRy9Vt6m0oeRif4nE_3r-Xn7_OxePhS6k7qVLRbUVc2WN4I3rSymjgTfCtpVta42u4rqVtYbpEZut63c8UoVphNciErwVlTVrpKlblWN-tgIlKRrzVnNaUZjS2tPc9YuTIwrdZu2Fk1hUZGN7zYJXYYe1DpGVnNrYoq3tGSSpe7lttl_lvO-05uBjAP8r3uKNdjubjwmTasqBz8z0WfFt-NhCT5PmYn-WnVkor8W_isAAP__Yh7uCA">