Index: include/llvm/Support/Error.h =================================================================== --- include/llvm/Support/Error.h +++ include/llvm/Support/Error.h @@ -147,7 +147,7 @@ // Expected needs to be able to steal the payload when constructed from an // error. - template class Expected; + template friend class Expected; public: /// Create a success value. Prefer using 'Error::success()' for readability @@ -642,7 +642,7 @@ { assert(Err && "Cannot create Expected from Error success value."); - new (getErrorStorage()) Error(std::move(Err)); + new (getErrorStorage()) error_type(Err.takePayload()); } /// Create an Expected success value from the given OtherT value, which