aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Sema/SemaExpr.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 500d5b7786..f75c3924a0 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -972,7 +972,13 @@ inline QualType Sema::CheckConditionalOperands( // C99 6.5.15
return compositeType;
}
}
-
+ // Need to handle "id<xx>" explicitly. Unlike "id", whose canonical type
+ // evaluates to "struct objc_object *" (and is handled above when comparing
+ // id with statically typed objects). FIXME: Do we need an ImpCastExprToType?
+ if (lexT->isObjCQualifiedIdType() || rexT->isObjCQualifiedIdType()) {
+ if (ObjCQualifiedIdTypesAreCompatible(lexT, rexT, true))
+ return Context.getObjCIdType();
+ }
// Otherwise, the operands are not compatible.
Diag(questionLoc, diag::err_typecheck_cond_incompatible_operands,
lexT.getAsString(), rexT.getAsString(),