[libcxx-commits] [libcxx] [libc++][math] Add `constexpr` to `copysign` functions (PR #216285)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Tue Aug 18 02:19:31 PDT 2026


philnik777 wrote:

> > Also, I don't really understand why you're trying so hard to make it work in the library instead of just updating Clang. I'm pretty sure it's not that hard if the builtin is already constexpr.
> 
> So I tried to test clang in my local build to see if there was anything I should do. After adding `Constexpr` to `Builtins.td` and checking `InterpBuiltin`, compiling and debugging, I think the problem lied in the `cmath` resolution for templated and non-templated functions because the builtin is already constexpr as you said.
> 
> I've added a comment about that but I'm not sure whether is pertinent nor if that's the solution we want, but I don't think [the lack of] compiler support is the problem here (apart from UCRT issues and so on).

The issue is that Clang doesn't make the C overloads `constexpr`, i.e. the `copysign`/`copysignf` etc. I'm quite certain that everything would work just fine if we change that.

https://github.com/llvm/llvm-project/pull/216285


More information about the libcxx-commits mailing list