summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2011-11-10 23:32:36 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2011-11-10 23:32:36 +0000
commit4a905b6799bc8c61b1195dd8a7cc95469901265d (patch)
tree8af051c6ed8f2559f6351f86e5e60d03861ff470 /clang
parent20be0b4397a03bfd30364d5083b4207aded5b28f (diff)
downloadbcm5719-llvm-4a905b6799bc8c61b1195dd8a7cc95469901265d.tar.gz
bcm5719-llvm-4a905b6799bc8c61b1195dd8a7cc95469901265d.zip
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
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Sema/Sema.cpp1
-rw-r--r--clang/lib/Sema/SemaOverload.cpp2
2 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index d36b67aed85..b8dec3cb6ba 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/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/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 4db75a3bdac..a8fdfcb0d40 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/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);
}
OpenPOWER on IntegriCloud