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

    <tr>
        <th>Summary</th>
        <td>
            Support lvalue statement expressions in C++
        </td>
    </tr>

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

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

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

<pre>
    Hi all,

I just discovered that the implementation of GNU statement expressions differs from GCC in C++ mode.

The following C++ code compiles in GCC but not in Clang:

```
void test(int& a) {
    &({ a; });
}
```

In clang, statement expressions are always prvalues and for that reason we cannot take the address. That is fine for C. 

For C++, I suggest to support lvalue/xvalue statement expressions in the same way as the comma operator or ternary operator.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx1UU1zmzAQ_TXislNGCIPhwCG2x2kuvTT9AWtYY6VCYiRhx_--C3bSdKZmNMt-6e3bp4Prrs13DWiMUFshd0I-3ewLvE0hQqdD687kqYN4wsiGQA-joYFsxKidBXeE5x-_IHC4ZIHeR08hcC3w_eORfICjdwM8b7egLWyF2vCBwXWUfp35yuBHZ4y7aNt_trXcxmYYtaEw359hDlME6-ICZ9D2In_6iiRKeT9LeHaa-VOIQlXasi0BhapBrDe3BuCPs1zmFNfyDdd23MLeHZHD_0Hf1bLQLjTU9oEQ6IlVvuA1wOjPaCbeBW3H-_qbsp4wsJoX3hXtvFrE37TojV03w6TwOvdpFlNbWi5uU_jKYj-nbqrNRF4gTH3PW0N07I6j8xHMMluo_fviPGDLss6TAw4EzBkwLDG_woDgRvIYedZMnbxFf_3MpQk1WVkW61KuapV0Td7VeY1J1NFQ8_MfEo9n35dIJm-aU4xjmJ9X7fn0Op6mQ8pEODDm_PH7Nnr3Ri0_7V6HwOKyU1R5mSWnppWqKDNcr6p6JansuqptVU6rrJayVus6MXggExpRbESxS3SjpFKZzFZZka0KlRZSqqzColofM1kdMsEoA2qTzoNT5_vENwuHw9QHLhodYvhbRN6rt0Qf-DjFk_NNiF4PLl9XyUK4Wdj-AcSXICM">