Due Diligence
Describe the bug
Several functions call the non-constexpr set_errno_if_required on their domain-error/special path without an is_constant_evaluated() guard, so evaluating them in a constant expression is ill-formed.
Guarding is inconsistent: sqrt(-1), fmod(1,0), and scalbn(inf,2) compile fine.
Steps to reproduce
#include <ccmath/ccmath.hpp>
// each of these fails to compile
constexpr double a = ccm::log(0.0);
constexpr double b = ccm::log(-1.0);
constexpr double c = ccm::acos(2.0);
constexpr double d = ccm::pow(-1.0, 0.5);
constexpr double e = ccm::tgamma(0.0);
constexpr int f = ccm::ilogb(0.0);
int main() {}
Error: non-constexpr function 'set_errno_if_required' cannot be used in a constant expression.
Expected behavior
All should compile as constant expressions and return the correct special value (for example log(0) = -inf), raising no errno at compile time.
Compiler version and type
Apple clang 17.0.0 (clang-1700.4.4.1)
Operating System
No response
Screenshots
Not applicable
Due Diligence
Describe the bug
Several functions call the non-constexpr set_errno_if_required on their domain-error/special path without an is_constant_evaluated() guard, so evaluating them in a constant expression is ill-formed.
Guarding is inconsistent: sqrt(-1), fmod(1,0), and scalbn(inf,2) compile fine.
Steps to reproduce
Error: non-constexpr function 'set_errno_if_required' cannot be used in a constant expression.
Expected behavior
All should compile as constant expressions and return the correct special value (for example log(0) = -inf), raising no errno at compile time.
Compiler version and type
Apple clang 17.0.0 (clang-1700.4.4.1)
Operating System
No response
Screenshots
Not applicable