[libcxx-commits] [libcxx] 8fbd6d9 - [libcxx/variant] Fix build error for when exceptions disabled.
Michael Park via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jun 18 07:22:01 PDT 2020
Author: Michael Park
Date: 2020-06-18T07:21:42-07:00
New Revision: 8fbd6d99a0931090fbee473ed9c5e0db8efe8bab
URL: https://github.com/llvm/llvm-project/commit/8fbd6d99a0931090fbee473ed9c5e0db8efe8bab
DIFF: https://github.com/llvm/llvm-project/commit/8fbd6d99a0931090fbee473ed9c5e0db8efe8bab.diff
LOG: [libcxx/variant] Fix build error for when exceptions disabled.
Reviewers: #libc!
Subscribers: libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D81973
Added:
Modified:
libcxx/include/variant
Removed:
################################################################################
diff --git a/libcxx/include/variant b/libcxx/include/variant
index 897361fc3be3..502d8d83aeab 100644
--- a/libcxx/include/variant
+++ b/libcxx/include/variant
@@ -1062,14 +1062,9 @@ public:
_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,11 @@ public:
throw;
}
}
+#else
+ // this isn't consolidated with the `if constexpr` branch above due to
+ // `throw` being ill-formed with exceptions disabled even when discarded.
+ this->__generic_construct(*__rhs, _VSTD::move(*__lhs));
+#endif
this->__generic_construct(*__lhs, _VSTD::move(__tmp));
}
}
More information about the libcxx-commits
mailing list