Complain on missing property getter method only
if property-dot expression is decidedly
an rvalue. // rdar://8155806.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122430 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 56ad9b4..e2a6d34 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -7097,8 +7097,15 @@
ExprValueKind VK = VK_RValue;
if (PRE->isImplicitProperty()) {
- QualType Result = PRE->getImplicitPropertyGetter()->getResultType();
- VK = Expr::getValueKindForType(Result);
+ if (const ObjCMethodDecl *GetterMethod =
+ PRE->getImplicitPropertyGetter()) {
+ QualType Result = GetterMethod->getResultType();
+ VK = Expr::getValueKindForType(Result);
+ }
+ else {
+ Diag(PRE->getLocation(), diag::err_getter_not_found)
+ << PRE->getBase()->getType();
+ }
}
E = ImplicitCastExpr::Create(Context, E->getType(), CK_GetObjCProperty,