<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/120759>120759</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Add support for `/Zc:enumTypes` compiler flag in MSVC mode
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Saalvage
</td>
</tr>
</table>
<pre>
MSVC used to have a [bug](https://developercommunity.visualstudio.com/t/underlying-type-of-an-unscoped-enum/524018) where enums always had the implicit underlying type of `int` , independently of the enum's items. This bug is [accomodated for](https://github.com/llvm/llvm-project/blob/main/clang/lib/Sema/SemaDecl.cpp#L17268-L17275) within clang's MSVC compatibility mode, while the fix for it (the `/Zc:enumTypes` flag) is not.
The issue with this is that this results in information being lost for the enum's items (as they are trimmed to fit the underlying type), so fixing this on the application side would likely require reparsing the items.
I believe this might potentially be a good fit for an option in `LangOptions.def`?
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUU8uu4zYM_RplQySw5Vey8CIzFwYKTNHFveiiO9qibbay5OqRjP--kJ3iAn0sZiWYJnl4Dg_Re54MUSuqL6J6O2EMs3XtO6J-4ESn3qqt_fn9168QPSkIFmZ8ECCI6ksfJ1G9CXmdQ1i9KO5CdkJ2ih6k7UpusMsSDYft8mAfUfsQFdvLYBchuyBkF40ipzc20zlsK53teEZzjsYPdiV1JhNTZiXLLL8KeYPnTI4ghT2gfuLmYUYFYSbgZdU8cIDPnpB6gh1B1BmbIOoMhPwKbBStZBSZoLf0O5UfUI0HDrT4C3zM7KGPE7BPTHEY7GIVBlIwWvdfrCcOc-xf5LR-_P2cV2d_pyHR7bXthewWZCNkN2g0U0riFHynBV_PGw36MqyrkMW3vJH19ZyeptoV4DCzgVdt42FfzWCXFQP3rDlssFhFiehzZk07u5G_p7GBAwh5TRFRZ0J2vw2iuCfqH9tKPgk0apwSDnswNlxEdhfZ_SPp632kHR5C0oY9hBnD8eHIRx08sAE2o3ULBrYGekpb0NaHHf3fOqdpMDWiDdARBMfLcrhs5LAX_GOdQt4SNZ8Svu_BhG_Nnotr8sCB7VkRPG3UCjT_QXoDR39GdgSOVnT-qKXXvg-eP0FPmulBR9eFpznAagOZwKj1Bn0y_mSt2sdLnNCAXXdANknUb2imX_aAvygak8xFd1JtoW7FDU_U5k1RNnlW181pbq9yaGRRY6nKvL_m16Ip5NDUY5XXBTU5nriVmSxzKbO8zkpZXpqrzPob1UVeVIhKijKjBVlfktUu1k2nfVFtLrOmup009qT9fttSGnoeaxRSplN37e7PPk5elJlmH_xnm8BBU3tXCnxcV-sOuv9nm2RA1uR2_yQpdlsmI56i0-0PX8o-pheye_F4tPKvAAAA___1t41C">