aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Sema/SemaExprCXX.cpp8
-rw-r--r--test/Analysis/reference.cpp2
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index 919ef06957..1b08aa2159 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -2324,12 +2324,14 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType,
// Nothing to do.
break;
- case ICK_Lvalue_To_Rvalue:
+ case ICK_Lvalue_To_Rvalue: {
assert(From->getObjectKind() != OK_ObjCProperty);
FromType = FromType.getUnqualifiedType();
- From = ImplicitCastExpr::Create(Context, FromType, CK_LValueToRValue,
- From, 0, VK_RValue);
+ ExprResult FromRes = DefaultLvalueConversion(From);
+ assert(!FromRes.isInvalid() && "Can't perform deduced conversion?!");
+ From = FromRes.take();
break;
+ }
case ICK_Array_To_Pointer:
FromType = Context.getArrayDecayedType(FromType);
diff --git a/test/Analysis/reference.cpp b/test/Analysis/reference.cpp
index c7912f4f02..5897e68288 100644
--- a/test/Analysis/reference.cpp
+++ b/test/Analysis/reference.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -analyzer-constraints=range -verify -Wno-null-dereference %s
// XFAIL
typedef typeof(sizeof(int)) size_t;