Implicit casts from rvalue to lvalue are not meaningful. Don't accidentally add

them when performing a const conversion on the implicit object argument for a
member operator call on an rvalue.

No change to the testsuite: the test for this change is that the added
assertion does not fire any more.

llvm-svn: 144333
This commit is contained in:
Richard Smith 2011-11-10 23:32:36 +00:00
parent 20be0b4397
commit 4a905b6799
2 changed files with 2 additions and 1 deletions

View File

@ -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());

View File

@ -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);
}