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

    <tr>
        <th>Summary</th>
        <td>
            [C23] constexpr incorrectly rejects infinity and nan
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            c23,
            clang:frontend,
            rejects-valid,
            constexpr
      </td>
    </tr>

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

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

<pre>
    Consider:
```
constexpr float inf = 1.0f / 0.0f;
constexpr float nan = 0.0f / 0.0f;
```
Clang currently rejects these, while GCC accepts: https://godbolt.org/z/oG4sP9TMc

I believe Clang is wrong to reject, per C23 6.5.6p6-7 for division, 5.2.5.3.3p19 for infinity being a valid value, 6.7.2p5-6 for constexpr requirements, and 6.6p4 for constant initialization requirements.

Note, `__builtin_inff()` and `__builtin_nan()` both work as an initializer for a constexpr variable.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsk0Fvoz4QxT-NuVixzBgIHDikRFT_w3-1h71XBkyYXWfM2ibd9tOvoNkmrSohY5iHfn4zDx0CnsiYmuUPLD8meomT8_VBe0cP2tqzpqRzw0vdOAo4GM_UgckjkwdWyOu1PfaOQjR_Zs9H63TkSCNn6shTIUfOoOVSyJGph6_VpGlTyy_Vn1CN1XTi_eK9oWhfuDc_TR8Dj5MJhkHDnye0hj82Ddd9b-YYmDrwKcZ53TBoGbQnN3TORuH8iUH7yqB1j1n4Xv34v78yt_U_3hmL5mL4GxQDf_aOTjy6K3blzcbzBhQvRC6Kudjt-eg8H_CCAR2tilyAyIUSak6rrYg0ImF84Z1BOnHNL9risK7LZqEQewFzvis29a1d3vxe0JuzoRhWnaaBF6KYs5tO09p9jKgtvuqIjj58Je79fXNxw7FCPj11C9qI9IQ0jgxKBhUr5Eb4UCZNt2rn4sSfnf_FdeCabmDjtxPpu7NftEfdWSOSoVZDpSqdmDrdA-SQl6lKpnqstJHd2I973eX7MtWy7Ls0g7Ks8myvVYI1SMhkKdM0B6WUKFWVmnSfDYOEEtTAMmnOGq2w9nJep5tgCIupU5lmVZVY3RkbtrAD9KAYAINm3a_jZeowekfR0PBeuIZrt83nJv9nan2THxNfr7xdt5wCy6TFEMPtBBGj3X6wBhTLj3cdQeqd96a_T_F7MtbGk6Zk8bb-FF6M09KJ3p0ZtCvmetvN3r1lst1cBwbt1filhr8BAAD__6E3OsE">