<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/116760>116760</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang does not warn about assignment to an undersized bit field vs. preferred type
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ojhunt
</td>
</tr>
</table>
<pre>
A problem I've hit in the llvm+clang is failure to identify undersized bitfields used to store enums. While clang does emit a warning for this directly, llvm uses raw integer field types for bitfields (apparently due to msvc failing to pack bitfields of different types :-/).
To mitigate this during debugging we use the preferred-type attribute to inform the debugging metadata, but we don't use it for any actual semantic checks, we should rectify this.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxcUsGOqzgQ_BpzaQWBE8Jw4JCZUaS9r7TnBrfBM8ZGdjtR9utXdiJl9S7gQ1d1VVdhjGZxRKPoPkX3XWHi1YfR_6zJcTV59RgvsAc_WdrgLyH7G8FqGIwDXgmsvW1Cfs4W3QImgkZjUyBgD0aRY6MfkJyiEM2_pGAyrA1ZFSFFUnkqsg8E5NIWa_hnNZbgSaY8RaDNMCDcMTjjFtA-AK8mgjKBZrYPIb-KhEwXIeAdjGNaKEBZA_zYKRbYe7OQH7jvGMixfYBKRewWb3MRn9ewhx3n3_9hvAZltKYMepGK4-Ug5FXIoRbNt2guz-_fHjbDZkGml9QUMqeiKS1Lft0pqy3X2wNpCoHUIXMCMgczJX6ez2kftjL2xm7EqJAx-54SZy7lnZA9F07DxSu6B-DMCS1E2tCxmWFeaf6NGXcniKtPVkG-YQ4o66wrNR7VcByworHtj7JpZNd9VOuoVT8P2AxN083zMHWqP2tFPZ4GRbrV58qMspGntm2Hpj8N7UeN7TQ3p2bq9dBRiyhODW1obJ2jqn1YKhNjorFtz_25qSxOZGMpoJQlfCFl7mIYM-AwpSWKU2NN5PimYMOWxq93V5znUhTAySeGZ7G3EpgHdH_U8FWQW6zfKZRkqxTsuDLvURwvJeDrYnhNUz37Tcjrs_Hld9iD_6GZhbwWQ1HI68vTbZT_BQAA___CGie4">