[libcxx-commits] [flang] [compiler-rt] [libc] [libcxx] [clang-tools-extra] [llvm] [clang] [libc++] Implement LWG3940: std::expected<void, E>::value() also needs E to be copy constructible (PR #71819)
via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jan 9 05:59:56 PST 2024
================
@@ -1150,12 +1150,15 @@ class expected<_Tp, _Err> {
}
_LIBCPP_HIDE_FROM_ABI constexpr void value() const& {
+ static_assert(is_copy_constructible_v<_Err>);
if (!__has_val_) {
std::__throw_bad_expected_access<_Err>(__union_.__unex_);
}
}
_LIBCPP_HIDE_FROM_ABI constexpr void value() && {
+ static_assert(is_copy_constructible_v<_Err> && is_move_constructible_v<_Err>,
+ "error_type has to be both copy constructible and move constructible");
----------------
PragmaTwice wrote:
done in 2614080a0e5260021a80140e5096bb86b46ebf23
https://github.com/llvm/llvm-project/pull/71819
More information about the libcxx-commits
mailing list