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

    <tr>
        <th>Summary</th>
        <td>
            Clang allows `nullptr` dereference in `constexpr`
        </td>
    </tr>

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

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

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

<pre>
    Hi! Clang accepts dereferencing a null pointer in a `constexpr` context when binding a reference to it but not reading the contents:

```cpp
constexpr auto b = [] {
  int* px = nullptr;
  int& x = *px;
  return true;
}();
```

MSVC and GCC both reject it:
https://godbolt.org/z/frceTafjj
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxckkFv2z4MxT8NfSEayFItxwcf2gT-_y87bdhdkplYhSoZEr1m-_SD46bNChgW8B4lPhI_U4o_R6IemmdojpVZeEq5n5NLMVY2jb_7_z3IGg_BxDMa52jmgiNlOlGm6PyqYlxCwDn5yJTRRzQIWrgUC9NlzqAFuhSZLoxvE0W0Po7bxdszhJzQM9qFMSbGTOZawRNtVyMXUE8gjiBufy22z83zpnw0RLNwQougjrgNhtA-b0WIPjLIJ5wvV3-NPnMG9a-vcbNBPs2XOzMTLzki54U-VGiPIPcgu0_llu0-8LfvPw9o4oj_HQ5oE0-Y6YUco-eP0Sbm-TqoHEAO5zTaFHiX8hnk8AfkcMqOfpjTy0s19mrsVGcq6mvdtarVSslq6rVpTu24r2WjR-PUqK1rRU2i2Wvb1qOtfC-FVLWom1rJRskddV0tlWsfqTGuOyl4FPRqfNiF8Ot17V35UhbqdVeLfRWMpVCuvEjpVipAyhWd3K_1D3Y5F3gUwRcuny-w50D9O0QhpLeyEnLbvRZ3RNEK0Bd8qiWH_stuPE-L3bn0CnJY-7wfD3NO61ZBDtfYBeRwTf43AAD__-t65Vg">