<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/55775>55775</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Function prototype with an undeclared struct, ends up making and discarding a temporary struct
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
russellw
</td>
</tr>
</table>
<pre>
I ran into this problem when trying to compile cpython with clang. A reduced test case:
void square(struct foo *f);
struct foo {
int x;
};
void square(struct foo *f) {}
Microsoft C is happy with this, but clang treats the undeclared struct as meaning 'make a temporary declaration of the struct, then throw it away' and as such, when it does encounter the function definition, it thinks it is incompatible with the prototype.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyFU8uO2zAM_Br5QjRQ5TiODz5kNwjQQz9CluhYu4rk6rGp_76U02RTtEABPyiTHA6H9OD10n-DIB0YlzykyUSYgx8sXuA6oYMUFuPOQD7lL7OxCGpe0uQdXE2aQFnpzhs4QECdFWpIGBMoGZHVB8aPjD-e3Yc3GuKPLAMysY8pZJVg9B6YOIxMdKx-ecQ-jOew9tMPhS_8_COlPf4T4X9lV1zKfSL73ajgox8TvAIJMsl5Xm79FoGYeIUhp1vvJBDKFMmBkJ1G-khSwO8yMsIFpSsKMtFe5DuCJIkusw8yLHALl8mQnH5cMW6JpURa5Z-Cv4IhpKtcCAKk0wU1ZjWVoHVG5NYeI6BTPruEYUUas1MrssbROFPMkkHB1IR7j8Wi5owrgyUONPN7j1h2IPm0zLipdF_rru5klUyy2J_usI-QWxat0F_9l3rodIQ8AzVfZCj8tYlKBr0en9S45VQ52H5KaY5lg8SJrjPh52FDPOlg7cf99YUovGEpczIxZqTJnJqmbZtq6vWAej9sJW-butZfd1LV22G345IL1dBdWTmgjT1rXpgQDknkAkE2a46V6QUXgjc1551oRLfZtd1e80aOuml2Hedsy_Eijd0UHhsfzlXoV0pDPkdyWhNT_HTKGM3ZIa7lCF9m-oVCH3KMaO21Wmv3K_dfAjguPQ">