[Core] Fix passing an rvalue reference of ErrorOr.
authorMichael J. Spencer <bigcheesegs@gmail.com>
Fri, 18 Jan 2013 21:42:01 +0000 (21:42 +0000)
committerMichael J. Spencer <bigcheesegs@gmail.com>
Fri, 18 Jan 2013 21:42:01 +0000 (21:42 +0000)
llvm-svn: 172850

lld/include/lld/Core/ErrorOr.h

index 0fd7d9650b827592327cdce525f17488667b8f50..85f91858db54ee60dd80fec347db1009ac687702 100644 (file)
@@ -208,6 +208,7 @@ public:
       return;
     if (!other.HasError) {
       // Get the other value.
+      IsValid = true;
       new (get()) storage_type(std::move(*other.get()));
       HasError = false;
       // Tell other not to do any destruction.
@@ -228,7 +229,7 @@ public:
       return *this;
 
     this->~ErrorOr();
-    new (this) ErrorOr(other);
+    new (this) ErrorOr(std::move(other));
 
     return *this;
   }