[libcxx-commits] [PATCH] D81973: [libcxx/variant] Fix build error for when exceptions disabled.

Michael Park via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 16 15:23:59 PDT 2020


mpark created this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
mpark edited the summary of this revision.

`lit -D compile_flags="-fno-exceptions" -sv test/std/utilities/variant`


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81973

Files:
  libcxx/include/variant


Index: libcxx/include/variant
===================================================================
--- libcxx/include/variant
+++ libcxx/include/variant
@@ -1062,14 +1062,9 @@
         _VSTD::swap(__lhs, __rhs);
       }
       __impl __tmp(_VSTD::move(*__rhs));
-      static constexpr bool __is_noexcept =
-#ifdef _LIBCPP_NO_EXCEPTIONS
-          true;
-#else
-          __all<(is_nothrow_move_constructible_v<_Types> &&
-                 is_nothrow_swappable_v<_Types>)...>::value;
-#endif
-      if constexpr (__is_noexcept) {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+      if constexpr (__all<(is_nothrow_move_constructible_v<_Types> &&
+                           is_nothrow_swappable_v<_Types>)...>::value) {
         this->__generic_construct(*__rhs, _VSTD::move(*__lhs));
       } else {
         // EXTENSION: When the move construction of `__lhs` into `__rhs` throws
@@ -1084,6 +1079,9 @@
           throw;
         }
       }
+#else
+      this->__generic_construct(*__rhs, _VSTD::move(*__lhs));
+#endif
       this->__generic_construct(*__lhs, _VSTD::move(__tmp));
     }
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81973.271222.patch
Type: text/x-patch
Size: 1080 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200616/b8529a7a/attachment.bin>


More information about the libcxx-commits mailing list