[libcxx-commits] [PATCH] D81954: Remove the try/catch codepath if `swap` is `noexcept`.

Zoe Carver via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 16 11:32:51 PDT 2020


zoecarver added a comment.

Thanks for making this patch. Other than the `noexcept` issue, this LGTM.



================
Comment at: libcxx/include/variant:1046
   inline _LIBCPP_INLINE_VISIBILITY
   void __swap(__impl& __that)  {
     if (this->valueless_by_exception() && __that.valueless_by_exception()) {
----------------
I think it would be good to also mark this `noexcept(__all<(is_nothrow_move_constructible_v<_Types> && is_nothrow_swappable_v<_Types>)...>::value)`.


================
Comment at: libcxx/include/variant:1072
+#endif
+      if constexpr (is_noexcept) {
         this->__generic_construct(*__rhs, _VSTD::move(*__lhs));
----------------
I think this is OK but, are there any compilers that we support that don't support `if constexpr` in C++17?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81954





More information about the libcxx-commits mailing list