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

    <tr>
        <th>Summary</th>
        <td>
            [Clang] Regression on not rejecting UB in constexpr reference initialization due to implementing P2280R4
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:frontend,
            accepts-invalid,
            constexpr
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          frederick-vs-ja
      </td>
    </tr>
</table>

<pre>
    Currently, Clang accepts the following code snippet since C++23 mode. [Godbolt link](https://godbolt.org/z/5cxGrq6Gb).

```C++
constexpr int& r = r;
```

[[dcl.ref]/6](https://eel.is/c++draft/dcl.ref#6) (as clarified by the resolution of [CWG453](https://cplusplus.github.io/CWG/issues/453.html)) indicates that such reference binding has UB, and thus needs to be rejected in constant evaluation.

Perhaps this is due to something missed in #95474.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxsk0Gv2yoQhX_NeINiOYNx4oUXN4mcbVWp6hrD2KbF4Ac4r7e__gkn7a2eKmFZAg3n8M0ZGaOZHFEH4gLiVsgtzT50YyBNwajvh0c8fJPF4PV7d91CIJfsO-CVXa10E5NK0ZoiSzOx0Vvr_zVuYsprYtGZdaXEonGK2BXwAnhBzhavqWQgLnevB28Ts8Z9B3EDPM8prRH4G2AP2E_P89KHCbD_CdgL9eMe_mnuA2BbQvWWV1M910sAqjflXUz0Yw3MuATYsMCA31gAfvmz4FWfn33RypaBxt1F3_zNDJEtTQTs1VNHBzkmwP5XJfIGsGWAZxmZsjKY0ZBmw_uOJlD0dkvGO-bH_Pbr13st-N-E1Gq3mL9yMmnehtJ4wP769Q7Ymxg3yiZqwcs5LRawzarGaaNkotwHmVjc1MwCjRQoox_ysZvYLCP7csm9k06zNG-ROSIdWfJsyB6_kUqkmXFsRyhdYvSQdpPZ-Iv3JwqzXLOQicxEpjfK9dEvlOasspgYn5cA8lbUp7osdMd1y1tZUHc81cdWnERbFXNH9XhqlRh4ez5WvKHT6aSVls25wloKLQrTYYWi4sf6yKuGV6XQx0oPR5IDNkI1HOqKFmlsae1jyUkpdkbdkR85rworB7JxzzaiyokF_jYG7xI5DYiAV0B8hfhg3ENa87H_O0h5R9yK0GWVw7BNEerKmpjih24yye5TtA8GiBv7TFOgGPemO-Z8eiHOlL5cfmPek_rRLeNMMtKanzv1X3zNslpayO3FnxDP1ee62ILt_jcyz8govwD22drrd1iDz9J_ZuiF6NHhfwEAAP__zJ9GuQ">