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

    <tr>
        <th>Summary</th>
        <td>
            clang: constexpr does not honor -fwrapv, leading to compilation error
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          markus-oberhumer
      </td>
    </tr>
</table>

<pre>
    godbold link: https://godbolt.org/z/8KhvbcWr6

reproducible with clang-trunk

```
$  clang++ -fwrapv -Wno-integer-overflow -c test.cpp
test.cpp:15:16: error: constexpr variable 'b2' must be initialized by a constant expression
```

```
$ cat test.cpp

// compile with: clang++ -fwrapv -Wno-integer-overflow -c test.cpp
//
// extra rant: -Wno-integer-overflow should not be needed here!

#include <limits.h>

#define wrap_inc(x)     ((x) + 1 < (x))

constexpr int int_max = INT_MAX;

bool b0 = wrap_inc(int_max);
const bool b1 = wrap_inc(int_max);

// error: constexpr variable 'b2' must be initialized by a constant expression
constexpr bool b2 = wrap_inc(int_max);
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy1VFFvmzAQ_jXmxSICQ0jywEPabtI0bU-TurfKxhfwamxkmyTtr98ZkjapWqmaNGTMnf3dx3fnA2HlU91aKayWVCvzSIot7UIYPBqEfcUx74aFdS16z3ivv3d70dy7imR3JNvOs4PBWTk2SmigBxU62mhu2jS4EVkvgKTKTmN2WUlnKGE3OGi6Ozg-7Gl6b2yqTIAWXGr34HbaHmja0AA-LJphmONfvGKbL-NUxRTAOeui0VjjAxwHR_fcKR7FEbYSDCfajz5QAVQZFRTX6hkkFU-Uz0HcBBoDwXtlzfvaP0qo4eGNzPNerCjy94M6lWkS-e_pz4xX7HAMjlOH-iP3-zy-syOeuLFTAQyAxNw7cEBYfi24UKbRo8SyFbda9Sr4BWr-8gYkYacMJoTSHzCAsPWRsA2NF9pnN-aXRyJ6Wonjguj1sFBwvB96fkT8Hf3289fDj-1vUtxc4oW1mopsQly8-hQYyc_4iZnO-PwT-OuC_p9memWbdbHP6Dr3WgJ1XlWbImdZuUpkXchNseFJUEFDPffTlWBpwU_H3Vlj3bnLCLulGrhUpqXBnvqSB5Q4J52MTtdvfgfYs6NYIBQdrffnR4qf_x9oArrK-xE8GstNvlkmXb3hecVktmOl2GXrdb7esbWUVcFY2TCoVonmArSvyRI_AWbgQCcKtMnyLlE1yxjLc1bmq3LFVgtRQJblXAIu7pqmImUGPVd6EXXE_1Ti6kmSGFuPm1p57NqXTY5n0GLLT69Dfj6Gzrq65-5x9KkV4LqxB5dMGuoph7-Zy5Zc">