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

    <tr>
        <th>Summary</th>
        <td>
            [expr.const] lvalue-to-rvalue conversion is not diagnosed
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    https://godbolt.org/z/KnPx1ejbb
```cpp
struct S {};

constexpr int f(S s) {
    constexpr S _ = s;
    return 0;
}

S s;
constexpr int _ = f(s);
```
This code compiles, but should produce errors for both `constexpr` initializations.

According to [[expr.const] p5.9](http://eel.is/c++draft/expr.const#5.9), the initializers of `_` cannot be constant expression because they contain lvalue-to-rvalue conversion of `s`, whose lifetime did not begin within the evaluation of the constant expression.

It shouldn't matter whether `S` is an empty class or has members; the lvalue-to-rvalue conversion in itself disqualifies expressions from being constant expressions.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8VMGO4ygQ_Rp8KbVFcJzEBx86k4202stK2fsIcDlmhMFLlTvT8_UryPSkezVqKYptqHrv8aoKTeSuAbEX7VG0p0qvPMXU_-EIw02_YGXi8NpPzAuJ5lmos1DnaxxM9FzHdBXq_EOo81_h7-8b_GaMkCchn8VO3n92We4rxGm1DBcQ-6PYn0Rz_BlZ_m0MxPh9SeACwyjU4QIkVFeiSwQAwCPqAl9BNCegXzh5PyGvKYB8gO9P71ku7-I_Mt7RMm9mfeS_HeP--c_kCGwcEGycF-eRhPoCZmWgKa5-gCXFYbUImFJMBGNMYCJPkI144xM7CS44dtq7H5pdDFS_F_lsbUyDC1fgCKUmx5xWFwDRnmBp6060J6EOuSi_aoLoa0dCna1QR6GOQ9Ij5_VHsmpyquqyap7wIQMTQRyzzK9ZntUhRAaDd8d1YMgoSORiAINWr4QZ4TUHsHYB_Iv2Kz5xfErlLW-8YCoJd2TKNqovcJsiIXg3IrsZYXAD3MmuLsDN8eRCEYcZp_iTAfLKb8R8cO7PtzoEofYMs2bGBLcJecKUJVyK9wQ6AM4Lv4L1mghigkkTzDgbTLlDCttnJ3IBHBP6EQZH_67au9EhvdNFMKY4g8Fcx9_oproa-mbomk5X2G_2stu26tDIauqNHZWy3cbYbrfVdo-bXds1uN2Zbmw2clO5Xkm1lY1s5EHKRtatRjO0Ru3tRrftAcVW4qydr71_mfOMVo5oxf7Q7Deq8tqgpzLtSgW8QdkUSuXhT33OeTLrlcRWekdMDxR27Ms18bEfPzWKSnEHp68hEg7Vmvz_7xLH02pqG2ehzpnr5-NpSfEb2tzCRWFu7XKC_wIAAP__3jSDTA">