<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/130584>130584</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Parts of std::numeric_limits<_BitInt(N)> broken
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
QrczakMK
</td>
</tr>
</table>
<pre>
`std::numeric_limits<_BitInt(N)>::digits` and `std::numeric_limits<unsigned _BitInt(N)>::digits` use `sizeof` to infer the range, and thus yield incorrect results if there are padding bits.
This causes `std::numeric_limits<_BitInt(N)>::min()` and `max()` to fail the build if there are padding bits, because they try to `constexpr`-compute a value which does not fit in the type.
Demo: https://godbolt.org/z/4bbb6YaPa
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUkk9r3DAQxT-NfBmyyLK96z34sElqKKUlhV56CpI1tqeRpUUaJdl8-mI3ECgkpSfD_Hnv96zRKdHkETvRXIvmttCZ5xC773F40Q9fvxQm2Esn9jKxFdVJVCefF4w03DtaiJOobu6viT97Fqr9JtRRVJ_-zFma1v5egvYWPlTIfmOw8E-pnHCTohcM41rgAORHjMAzQtR-QqFuNkeec4ILobNAfggx4sAQMWXHCWhcFyKCjghnbS35CQxx2gl5EvL0Y6YEg84J08fo7xAv5IVq18pb_kU_v9U4wKjJbdgm0wr5HtIayOAGs05cgONl3Rd7OQSfGJ_PUezl1RCWc2YEDY_aZYSnmYYZbMAEPjCMxEB-M-TLGV-D3uISRHWCmfmcVnbVC9VPwZrgeBfiJFT_IlRfG2P2P_WdLmxX2WN11AV25aEu97Jp1b6Yu7o64rHRskYzSCyHsm1Vq23TjLa2dXUsqFNSNbIqZVmqqm520pixbQ7moK1VzaERtcRFk9s597is3gWllLErK9m0deG0QZe2O1XK4xNsXaHUeraxW5euTJ6SqKWjxOlNhokddnc6coIwwn-8JpgYHtAXObrur19EPGezG8IiVL86vX6uzjH8woGF6je-JFT_GuCxU78DAAD__wKNGCI">