<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/60901>60901</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            `__builtin_bit_cast` doesn't properly convert to bool if the value was not 0 or 1
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            c++20,
            clang:frontend
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          tbaederr
      </td>
    </tr>
</table>

<pre>
    See godbolt: https://godbolt.org/z/P9v65oaba

Filing this against clang since it seems to be the outlier.

```c++
constexpr char c = 2;
constexpr bool b = __builtin_bit_cast(bool, c);
```

```
<source>:2:16: error: constexpr variable 'b' must be initialized by a constant expression
constexpr bool b = __builtin_bit_cast(bool, c);
               ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
<source>:2:20: note: value 2 cannot be represented in type 'bool'
constexpr bool b = __builtin_bit_cast(bool, c);
                   ^
1 error generated.
```

bools are 1 byte large, not 1 bit, so this shouldn't be a problem as far as I can see.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0lM_u4yYQx59mfBlthMF24oMP2V_WUm-V-gAR4PnZVAQiGKfNHvrsFXa02z-7PXURCoHRDPMZ5muds5sD0QDtR2gvlV55iWlgo2milCoTp-fwCxHOcTLRM6gzLsz3DOoMcgQ5vgyHmGaQ42eQ48_9o2ujNhrEBcR5_x2dd2FGXlxGPWsXMqP1OsyYXbCEjjET3TJyREPIC2Fc2TtKh7-GgU7s04L8WOZ2amPITL_fE9pFJ7QI6oIS1L_MJkaPZjNfr2Z1nl24GsdXqzODPBU7yDe0IPsv7l_u_GYir616y3FNlkB9AnWWoM51V4pFKcVU_nxN4qGT08YTgjwakEe8rZkLtAuOnfbuM01onqh3Hx0Yix_l7GL4X4jw7wPaT_jH98d3CaUoYCEylfWh_Uoo0eoQ4saTqGRNgWlCF5Cf9515S-n4I0heNLut3ouPMwVKmmk6_Md7lugZdSKs0TyZ0Os0U7mvwNRoHJdNjnsL5yWufgogjxupxnuKxtMNdcZ3ncryU6lEaepDNQ1q6lWvKxrq7tj1fSNqWS2Davtu6lSvlW2PfS0kKdvUp7Y9NfLUnOrKDVJIJaSs67b4HBrRtLoRtrXUqL49QSPopp0_eP-4FQ1WLueVhk70oq68NuTzpm0pX4qRAqQE-VZOiv5And9TDExhKob2UqWhBPtg1jlDI7zLnL-GZ8eeBujEN96oEzhFyntV7ineKflnaeIHJd6EXZ7YvW_q3tvlN523AguMCetqTX74x-fF8bKag403kGPJ4rV8uKf4K1kGOW7EGeS4Qf8ZAAD___tOe7g">