[libcxx-commits] [libcxx] [libc++] Fix UB in <expected> related to "has value" flag (#68552) (PR #68733)
Jan Kokemüller via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Oct 17 11:29:17 PDT 2023
================
@@ -909,6 +878,14 @@ class expected {
std::__expected_construct_unexpected_from_invoke_tag, _Func&& __f, _Args&&... __args)
: __unex_(std::invoke(std::forward<_Func>(__f), std::forward<_Args>(__args)...)) {}
+ template <class _Union>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(bool __has_val, _Union&& __other) {
+ if (__has_val)
+ std::construct_at(this, std::in_place, std::forward<_Union>(__other).__val_);
----------------
jiixyj wrote:
done!
https://github.com/llvm/llvm-project/pull/68733
More information about the libcxx-commits
mailing list