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

    <tr>
        <th>Summary</th>
        <td>
            [Clang] constant evaluation should reject reinterpret_casting arbitrary addresses
        </td>
    </tr>

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

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

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

<pre>
    Clang currently accepts
```c++
#define fold(x) (__builtin_constant_p(x) ? (x) : (x))
constexpr int* x = fold((int*)123);
```

It looks like this has been added for GCC compatibility over a decade ago. However, GCC rejects this since version 7: https://godbolt.org/z/qMoK83dfP. I don't see a good reason this should be accepted, especially since GCC has started rejecting it a long time ago by now.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxcUu1u2zoMfRr5D9HAluw4-eEfbgrfW1xcYG8Q6IOxtSqSJ9Fps6cf5LjrMICACIk8Ooc8MiU7esSONc-seSnkQlOI3TxZ5-1b27aFCubenZz0I-glRvTk7iC1xpkSK3u2Lx-hGX_OUfaMC4MX6xEuwRnGDx-MH4Hxw_msFuvI-rMOPpH0dJ5_P4sBvvL-M89R9ms5fswRrCfGe_gAJl4-4Rk_PK4ZP1Zc5Bbx_Ce1nJf9K4EL4S2Bs28INNkEk0ygED1IY9DAJUT453QCHa6zJKuss3SHcMMIEgxqaRDkGHbwb3jHG0bGT2t9xO-oKT0wk_Ua4YYx2eChzVomojkx0TM-MD6MwajgaBfiyPjwk_Hhx__hv4Mwl287eAUTPOMtQUIECWMIBiLKFPwGP4XFGVC47QBNZoFpRm2lc_ft_0wrq0skI6HZKFo_giWQ4IIfgex11QPqDj687wrTCXMUR1lgV7VNUzfloa2LqdtrUV2EErUSTdWgblQtj3xfY7svW5RlYTte8qY8VG3VVrWod3J_EcIc0Yh9VTd7xeoSr9K6nXO3a1Ze2JQW7KqmLnldOKnQpdWDnOvsNcZ5tmPscsOTWsbE6tLZROkLgiy51birO1nzAp-2ArxJt0jKG9gG9hgARLSeMM4R6axlWicio7IUZbxnG0RMCVOxRNf9tTZL06J2OlwZHzKH7XiaY8jQjA-rpsT4sMm6dfxXAAAA__9vqBTr">