diff options
-rw-r--r-- | lib/Sema/Sema.cpp | 1 | ||||
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp index d36b67aed8..b8dec3cb6b 100644 --- a/lib/Sema/Sema.cpp +++ b/lib/Sema/Sema.cpp @@ -252,6 +252,7 @@ ExprResult Sema::ImpCastExprToType(Expr *E, QualType Ty, break; } } + assert((VK == VK_RValue || !E->isRValue()) && "can't cast rvalue to lvalue"); #endif QualType ExprTy = Context.getCanonicalType(E->getType()); diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index 4db75a3bda..a8fdfcb0d4 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -4090,7 +4090,7 @@ Sema::PerformObjectArgumentInitialization(Expr *From, if (!Context.hasSameType(From->getType(), DestType)) From = ImpCastExprToType(From, DestType, CK_NoOp, - From->getType()->isPointerType() ? VK_RValue : VK_LValue).take(); + From->getValueKind()).take(); return Owned(From); } |