<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64923>64923</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[C++] Side effect get removed if the return type of a unary operator is `std::nullptr_t`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
c++,
clang:frontend,
clang:codegen
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ChuanqiXu9
</td>
</tr>
</table>
<pre>
This comes from https://github.com/llvm/llvm-project/issues/58459 but I find it is not related to coroutines after I reduce it.
Reproducer: https://godbolt.org/z/TGefxv5e5
>From the generated code, we can see the call to `DoAnotherThing()` is elided incorrectly.
And if we change the return type of `operator++`, we can find the problem is gone: https://godbolt.org/z/TGefxv5e5
While I tagged `codegen`, I feel like this is a frontend issue.
CC people since I know not so many people subscribed to the `c++` tag: @AaronBallman @cor3ntin @Endilll @erichkeane
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVE9vnDgU_zTm8rQjxzAMHDiQmWU1191I21tl7Ae4MTa1TdLpp68ek0mTtqdICGwZ3u_P-z1kjGZ0iA3b37P9KZNrmnxojtMq3Vfzaa2z3utL8zCZCMrPGGEIfoYppSWyvGWiY6IbTZrWfqf8zERn7dPt8dcS_BdUiYnOxLhiZKLbV8W-hn5NcIbBOA0mgYngfIKAVibUkDwoH_yajMMIckgY4AwB9aoQTNoxfmK8vd7_xSV4Oggsb3-l5XXvbdr5MDLRfWeie_gHh29Pe9y_LdGRoDQhjOgwbAyU18jEEZ4RlHQQEbcXlLSW2LGSn3zrfJowPEzGjUxUTNSs5CQFrdGowTjlQ0CV7OUd45Y0D1vpSbrxWjlgWoODdFkQ_EAAfiEuPjBxT1fJ3_DZfKPPluB7izOhjt7hhy34fzIW4QxJjiNqgicHRnQvuGcYEC1Y80h0TSRASUlwCUkONfedyOMRFvSLRYjGKSr96Pzz1uXoYZbu8nq-9lEF01_7TqII_VU1USJZrOCtDN7dS2tn6WivfMhdMtv6b6eNtZaWGIyaHlE6hCuXTDe5rvNaZtjclbU4VHcHccimpiq0KMocC4qkLg8DFqpUqh8O-iDzXmSmEVzkvBI5r3lVHHb8TlWillVfClXxnhPcLI3dUdrJ5GyzoimLWuSZlT3auE2WEDdJQjBxpL2VjpTdTPzt4NYBIWguQ7MNVL-OkRXcmpjiT9Bkkt0m-PgCsj_Bf0Yj4DCgSjAiDdfsn3CL3h8CJ2F1MlzgljpqMCt5TJqilLdutXZJ4XNiJc_WYJuP_wA2b34EAAD__w7Ya_c">