summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2008-10-20 18:19:10 +0000
committerSteve Naroff <snaroff@apple.com>2008-10-20 18:19:10 +0000
commitea54d9ef72cc3467e13710072245f35464a3440e (patch)
tree633174dcce9ebfb1b23b89e98e10b5820fabc0c4 /clang/lib/Sema
parentaac74a90552a6e18311f992baf260ac343034e4b (diff)
downloadbcm5719-llvm-ea54d9ef72cc3467e13710072245f35464a3440e.tar.gz
bcm5719-llvm-ea54d9ef72cc3467e13710072245f35464a3440e.zip
Sema::CheckCompareOperands() and ASTContext::mergeTypes(): Change handling of ObjC qualified id types to be consistent with gcc. This changes a handful of test case errors into warnings (diff will tell you which cases have changed).
llvm-svn: 57841
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 563718ccc8d..1f885165cd9 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -2061,6 +2061,13 @@ 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());
+ return QualType();
+ }
if (ObjCQualifiedIdTypesAreCompatible(lType, rType, true)) {
ImpCastExprToType(rex, lType);
return Context.IntTy;
OpenPOWER on IntegriCloud