aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaCast.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2011-10-31 20:59:03 +0000
committerEli Friedman <eli.friedman@gmail.com>2011-10-31 20:59:03 +0000
commit7a420df78dd207d505b0c05d5f4b12a627b8b994 (patch)
tree53a40a408c9336841fa53c7749f4e688f0c06329 /lib/Sema/SemaCast.cpp
parent6a7c94af983717e2c2d6aebe42cb4737c1c7b9e6 (diff)
Add missing lvalue-to-rvalue conversion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143364 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaCast.cpp')
-rw-r--r--lib/Sema/SemaCast.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Sema/SemaCast.cpp b/lib/Sema/SemaCast.cpp
index 7a063036c2..20742a0c35 100644
--- a/lib/Sema/SemaCast.cpp
+++ b/lib/Sema/SemaCast.cpp
@@ -529,6 +529,12 @@ CastsAwayConstness(Sema &Self, QualType SrcType, QualType DestType,
/// Refer to C++ 5.2.7 for details. Dynamic casts are used mostly for runtime-
/// checked downcasts in class hierarchies.
void CastOperation::CheckDynamicCast() {
+ if (ValueKind == VK_RValue && !isPlaceholder(BuiltinType::Overload)) {
+ SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.take());
+ if (SrcExpr.isInvalid()) // if conversion failed, don't report another error
+ return;
+ }
+
QualType OrigSrcType = SrcExpr.get()->getType();
QualType DestType = Self.Context.getCanonicalType(this->DestType);