https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120932
Bug ID: 120932
Summary: Some math builtins (nextafter) needs trapping math
turned off for constexpr
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
```
if (real_nextafter (result, format, arg0, arg1)
/* If raising underflow or overflow and setting errno to ERANGE,
fail if we care about those side-effects. */
&& (flag_trapping_math || flag_errno_math))
return false;
/* Similarly for nextafter (0, 1) raising underflow. */
else if (flag_trapping_math
&& arg0->cl == rvc_zero
&& result->cl != rvc_zero)
return false;
```
Testcase:
```
#include <cmath>
constexpr float a = std::nextafter(0.0f, 1.0e+0f);
```
Compile with -std=c++23 and this is rejected because of trapping-math is turned
on