This fixes a mismatch between the declared error_type and the type used with
the placement new that initializes the field.
Patch by Yichao Yu.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285970
91177308-0d34-0410-b5e6-
96231b3b80d8
// Expected<T> needs to be able to steal the payload when constructed from an
// error.
- template <typename T> class Expected;
+ template <typename T> friend class Expected;
public:
/// Create a success value. Prefer using 'Error::success()' for readability
{
assert(Err && "Cannot create Expected<T> from Error success value.");
- new (getErrorStorage()) Error(std::move(Err));
+ new (getErrorStorage()) error_type(Err.takePayload());
}
/// Create an Expected<T> success value from the given OtherT value, which