summaryrefslogtreecommitdiffstats
path: root/lib/Sema/SemaPseudoObject.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2014-08-04 17:28:05 +0000
committerOlivier Goffart <ogoffart@woboq.com>2014-08-04 17:28:05 +0000
commit7e0b0ec1bbe82f2db8fafb29b4c0eb00acd9786a (patch)
tree052496eea5eb82f4f696c45e12b97433ab322bdb /lib/Sema/SemaPseudoObject.cpp
parent30d47b46c3682ac7cfb1b8d20cc0664cd665a1da (diff)
Fix crash when assiging to a property with an invalid type
This is a regression from clang 3.4 Set the result to ExprError and returns true, rather than simply returns false because errors have been reported already and returning false show a confusing error git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@214734 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaPseudoObject.cpp')
-rw-r--r--lib/Sema/SemaPseudoObject.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Sema/SemaPseudoObject.cpp b/lib/Sema/SemaPseudoObject.cpp
index c8d34f84e1..fac7774734 100644
--- a/lib/Sema/SemaPseudoObject.cpp
+++ b/lib/Sema/SemaPseudoObject.cpp
@@ -845,7 +845,12 @@ bool ObjCPropertyOpBuilder::tryBuildGetOfReference(Expr *op,
if (!S.getLangOpts().CPlusPlus) return false;
findGetter();
- assert(Getter && "property has no setter and no getter!");
+ if (!Getter) {
+ // The property has no setter and no getter! This can happen if the type is
+ // invalid. Error have already been reported.
+ result = ExprError();
+ return true;
+ }
// Only do this if the getter returns an l-value reference type.
QualType resultType = Getter->getReturnType();