diff options
author | Steve Naroff <snaroff@apple.com> | 2008-05-31 22:33:45 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2008-05-31 22:33:45 +0000 |
commit | aa73eec076a2545671f78cb4e82536ec39f040eb (patch) | |
tree | b4abd8fd2d44e2c1be94e8245c105bb40589fcba /lib | |
parent | 8ea78e6e5717d8e6ea9cd31a5d5982494dab6bff (diff) |
Teach Sema::CheckConditionalOperands() to check for ObjCQualifiedIdType's. This fixes a bogus error.
<rdar://problem/5967036> clang on xcode: error: incompatible operand types ('id<DTOutputStreams>' and 'DTFilterOutputStream *')
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51828 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 8 |
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(), |