[libcxx-commits] [PATCH] D79555: [libc++] [C++20] [P0415] Constexpr for std::complex.

Marek Kurdej via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Mar 28 23:58:16 PDT 2021


curdeius added inline comments.


================
Comment at: libcxx/include/complex:724
+}
+#else
 template<class _Tp>
----------------
Quuxplusone wrote:
> IIUC these two `operator*` implementations are identical //except// that the C++20 one has an extra block under `__libcpp_is_constant_evaluated`, and then //also// replaces `copysign` with `__copysign_constexpr` even //outside// that block.
> Would it be possible to combine the `operator*` implementations through judicious use of `#if` (for the first diff) and `#define _LIBCPP_COMPLEX_COPYSIGN __copysign_constexpr` (for the second diff)?
> 
> (Also, my ADL senses are on high alert through this entire function, but I guess we expect `_Tp` always to be a primitive type, so ADL doesn't matter here.)
Concerning ADL, it's unspecified by the standard what happens if `_Tp` is other than `float`, `double`, `long double`. Even less if it's a non-primitive type :).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79555/new/

https://reviews.llvm.org/D79555



More information about the libcxx-commits mailing list