From c68e382ba923f0148720c017a475bd0ce1a10ed4 Mon Sep 17 00:00:00 2001 From: Steve Naroff Date: Wed, 4 Jun 2008 15:07:33 +0000 Subject: ASTContext::typesAreCompatible(): id is compatible with all qualified id types. llvm-svn: 51939 --- clang/lib/AST/ASTContext.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'clang/lib/AST/ASTContext.cpp') diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 5a3ca44a6b0..a87efa7425e 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -1639,7 +1639,16 @@ bool ASTContext::typesAreCompatible(QualType LHS_NC, QualType RHS_NC) { return isObjCIdType(RHS); if (isa(RHS)) return isObjCIdType(LHS); - + + // ID is compatible with all qualified id types. + if (isa(LHS)) { + if (const PointerType *PT = RHS->getAsPointerType()) + return isObjCIdType(PT->getPointeeType()); + } + if (isa(RHS)) { + if (const PointerType *PT = LHS->getAsPointerType()) + return isObjCIdType(PT->getPointeeType()); + } // C99 6.7.2.2p4: Each enumerated type shall be compatible with char, // a signed integer type, or an unsigned integer type. if (LHS->isEnumeralType() && RHS->isIntegralType()) { -- cgit v1.2.3