summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 5304fd9f7a5..d1be2a4a272 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -2147,11 +2147,14 @@ QualType Sema::CheckCompareOperands(Expr *&lex, Expr *&rex, SourceLocation loc,
}
if ((lType->isObjCQualifiedIdType() || rType->isObjCQualifiedIdType())) {
- if ((lType->isPointerType() || rType->isPointerType()) &&
- !Context.typesAreCompatible(lType, rType)) {
- Diag(loc, diag::ext_typecheck_comparison_of_distinct_pointers,
- lType.getAsString(), rType.getAsString(),
- lex->getSourceRange(), rex->getSourceRange());
+ if (lType->isPointerType() || rType->isPointerType()) {
+ if (!Context.typesAreCompatible(lType, rType)) {
+ Diag(loc, diag::ext_typecheck_comparison_of_distinct_pointers,
+ lType.getAsString(), rType.getAsString(),
+ lex->getSourceRange(), rex->getSourceRange());
+ ImpCastExprToType(rex, lType);
+ return Context.IntTy;
+ }
ImpCastExprToType(rex, lType);
return Context.IntTy;
}
OpenPOWER on IntegriCloud