<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/100902>100902</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] NRVO used in C mode
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
TedLyngmo
</td>
</tr>
</table>
<pre>
This C program exits with `1` even though it should exit with `0`. To the best of my knowledge, NRVO is not allowed in C:
```c
typedef struct {
int i, j;
double a, b;
} S;
S* ptr;
S test(void) {
S s = {0};
ptr = &s;
return s;
}
int main(void) {
S t = test();
return ptr == &t;
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0Ul1vm0AQ_DXLyyrWsTZfDzwksfxUtVIT9f3g1nDpwVl3i1P_-wpDEqdKEQLdzO7MgEbHaLuRuYbsAbJ9oifpfaif2Xy7jN3gk8abS_3c24iPeAq-C3pA_mMl4quVHiFXKeQK-cwjSu-nrkcrGHs_OXMdfJ9TkKsNPnuUnrHhKOiPOFzw9-hfHZuOgR7x-89fP9BGHL2gds6_skE74iNs70HtQd1Drpa7Xc5yObHhI0YJUysIxcOCox0F7Sz5Ats3DBGNnxrHqGemeWeg2OPTx-n6fAK6x5OEf2EUjgJUnr01QNWNJSI-YUTY7mdQQbH_ZH2SsHCUx09EYJnCiPE2zq3l_CmDtuP_TeUqvAYDqr6SX-3XBPKF2duvTUy9NdW20gnXaUGUpmW1q5K-LlOu9DHLDefbjE2ljS7VsSw0laXiJktsTYp2qqCC5qvaVLnJyoyoLcp2Z0wKO8WDtm7j3HnY-NAlNsaJ61SpSlHidMMuXstI1Do9dkA09zLU88JdM3URdsrZKPFDQqy4a4OXjWy_1GiKa3lw8IaTKbi6FznFuUt0ADp0Vvqp2bR-ADrMauvr7hT8C7cCdLimi0CHNeC5pr8BAAD__yj96GE">