[libcxx-commits] [libcxx] WIP [libc++][math] Add `constexpr` to `copysign`, `copysignf`, `copysignl` (PR #216285)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Tue Sep 29 01:45:53 PDT 2026


philnik777 wrote:

> [Addressing only the C++ side here; I don't know enough about the new C constexpr rules to comment.]
> 
> > 3. Diagnose the `foo` form in a constant expression evaluation context in C and C++ before C++26 as being a Clang (or GNU?) extension
> 
> How would you diagnose this? In particular, what would you do in a "trial evaluation" context, such as:
> 
> ```c++
> void f() {
>   const int n = fabs(1.0);
>   // do something that depends on whether `n` is usable in constant expressions
> }
> ```
> 
> I think your options for this are either that we allow the evaluation (which is _not_ a conforming extension)

Could you elaborate on why it's non-conforming?

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


More information about the libcxx-commits mailing list