Fix regression in comparison of qualified id; == operator was being

created with LHS and RHS whose types didn't match.

llvm-svn: 58049
This commit is contained in:
Daniel Dunbar
2008-10-23 23:30:52 +00:00
parent a6090204a1
commit 340b5ddcf9
2 changed files with 10 additions and 1 deletions

View File

@@ -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;
}
}

View File

@@ -0,0 +1,7 @@
// RUN: clang -emit-llvm -o %t %s
@protocol P @end
int f0(id<P> d) {
return (d != ((void*) 0));
}