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

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Mar 26 14:49:20 PDT 2021


Quuxplusone added a comment.

Looks like your new rebase succeeded in preserving the "unforked" implementations of `operator*` and `operator/`. They LGTM code-wise now.
No comment on the math part. It seems like `complex_times_complex.pass.cpp` does a pretty thorough job of testing its behavior, though, so I trust it.



================
Comment at: libcxx/include/complex:739
+    return __lcpp_x < __lcpp_y ? __lcpp_y : __lcpp_x;
+  } else
+#endif // _LIBCPP_STD_VER > 17
----------------
My impression is that you don't need these dangling `else`s (lines 739, 750, 777) for any C++ reason (like, the `else` on line 739 is not saving you from having to resolve and instantiate `fmax` on line 741). Do they improve codegen? If not, I say eliminate them — splitting unbraced control-flow structures across `#if/#endif` in this way is not-good. (Consider what happens if you replace line 741 with two lines of code, for example.)


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