[libcxx-commits] [libcxx] [libc++] Constrain additional overloads of `pow` for `complex` harder (PR #110235)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Tue Oct 22 02:08:43 PDT 2024


philnik777 wrote:

> > FWIW I'd be more in favour of simply removing the `static_assert` again, since I've only added it because I thought that was a requirement before my change.
> 
> Hmm... Just removing `static_assert` doesn't make `__promote` SFINAE-friendly, and will make the error messages worse for the case in #109858.
> 
> In libc++, we generally constrain the additional overloads (in `<cmath>`) that use `__promote` to accept only arithmetic types. But currently we are not doing so for `pow` overloads for `complex`, so hard error can raise from them.

Well, the overloads for complex are constrained to only accepting complex. The only way to trigger this is to specialize complex, which is already kinda fishy IMO.

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


More information about the libcxx-commits mailing list