diff options
author | Daniel Dunbar <daniel@zuster.org> | 2008-10-23 23:30:52 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2008-10-23 23:30:52 +0000 |
commit | c6cb77f1e5c4455edfa9c96bf5a8ef463d4c8d54 (patch) | |
tree | c16b601cc0578dec47cfabc4b0f025f61ef2f2fa | |
parent | d9c179d97f01c3e4e8d49ff7fea65bc32f59ed50 (diff) |
Fix regression in comparison of qualified id; == operator was being
created with LHS and RHS whose types didn't match.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58049 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 4 | ||||
-rw-r--r-- | test/CodeGenObjC/2008-10-23-invalid-icmp.m | 7 |
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 5cc234e640..9f27f8d7cd 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -2153,6 +2153,7 @@ QualType Sema::CheckCompareOperands(Expr *&lex, Expr *&rex, SourceLocation loc, Diag(loc, diag::ext_typecheck_comparison_of_distinct_pointers, lType.getAsString(), rType.getAsString(), lex->getSourceRange(), rex->getSourceRange()); + ImpCastExprToType(rex, lType); return Context.IntTy; } if (ObjCQualifiedIdTypesAreCompatible(lType, rType, true)) { @@ -2161,8 +2162,9 @@ QualType Sema::CheckCompareOperands(Expr *&lex, Expr *&rex, SourceLocation loc, } else { if ((lType->isObjCQualifiedIdType() && rType->isObjCQualifiedIdType())) { Diag(loc, diag::warn_incompatible_qualified_id_operands, - lex->getType().getAsString(), rex->getType().getAsString(), + lType.getAsString(), rType.getAsString(), lex->getSourceRange(), rex->getSourceRange()); + ImpCastExprToType(rex, lType); return Context.IntTy; } } diff --git a/test/CodeGenObjC/2008-10-23-invalid-icmp.m b/test/CodeGenObjC/2008-10-23-invalid-icmp.m new file mode 100644 index 0000000000..abfe6afcc7 --- /dev/null +++ b/test/CodeGenObjC/2008-10-23-invalid-icmp.m @@ -0,0 +1,7 @@ +// RUN: clang -emit-llvm -o %t %s + +@protocol P @end + +int f0(id<P> d) { + return (d != ((void*) 0)); +} |