<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/152293>152293</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
When compiling C to IA-32, Clang makes `wchar_t` an alias of `int`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
pascal-cuoq
</td>
</tr>
</table>
<pre>
When targeting IA-32, Clang defines `wchar_t` as `int`. GCC chooses to define it as `long`. This makes the program below behave differently between one and the other (CE link: https://gcc.godbolt.org/z/jxsqP91zz ):
```
#include <stdio.h>
int main(void) {
char * r =
_Generic(L'a',
int:"int",
unsigned:"unsigned",
long:"long",
unsigned long:"unsigned long");
printf("wchar_t is %s\n", r);
}
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxsks9u2zAMxp-GvhAJZDr-d_DBdZpiwA47DNixkGzFVqtIqSSna59-kOO1XTDAgCXy-ySK_HHv1WikbCC_g3yf8DlM1jVn7nuuN_1sXxJhh7fm1yQNBu5GGZQZ8Vu7yQiow05zM-Igj8pIj1Cw137i7jFAwZAvAWXiZosPXYf9ZK2XHoNdLajCKtPWjIvu56Q8nvhzlE0Sz86Ojp9QSG1fUciJXyQO6niUTpqg31DI8CqlQWskcjMsJhsm6RCo6u5RK_MMWYtTCGcPWQt0ADqMfb8d7SCsDlvrRqDDO9Dh6bd_-VGn7-8IVEcta6Fg68daoEyZXs-DRMg6HwZltxNk9zHFWmUCnrgyQNXFqgGoRijvgLWIiLErCNSiQ8j2a_DxQRrpVA9UfQcqOVAJ1MVkbFosleKCaI0i4myWeQ3X7Mfuq2Tp5JJeVv9zf9H8G4riGrK_VZ-dMuEIVAHROlhUHoFyD3lnrmej-_BAub9pWTI02VBnNU9kk5b5blfWRZUmU5PvRCZ2vCqHIk2ZzLkQLBfprqr6TKRllqiGGOWsYkWaUsXYlnGZ82LgrM_LQgwF7Jg8caW3Wl9OcYiJ8n6WTZoT1VmiuZDaL1wT9RHTWG6-T1wTDRsxjx52TCsf_OcRQQUtr7T39nRWOtLeRWBvkL8SegO8Qa4V92iPn-Qns9PNDXwqTLPY9vYEdIhXr7_N2dkn2Qegw_IUD3RYX3Np6E8AAAD___zjGbY">