From b107143feddf0f8cfac2fc313b63650d640a49fa Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Mon, 18 Apr 2011 21:16:59 +0000 Subject: Fix a bug in calculation of composite type of conditional expressions of objc pointer types where one type is the immediate base type of the other. // rdar://9296866 llvm-svn: 129718 --- clang/lib/AST/ASTContext.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'clang/lib/AST/ASTContext.cpp') diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index f723f2a8b7b..524a7563e64 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -4963,10 +4963,10 @@ QualType ASTContext::areCommonBaseCompatible( const ObjCObjectType *RHS = Rptr->getObjectType(); const ObjCInterfaceDecl* LDecl = LHS->getInterface(); const ObjCInterfaceDecl* RDecl = RHS->getInterface(); - if (!LDecl || !RDecl) + if (!LDecl || !RDecl || (LDecl == RDecl)) return QualType(); - while ((LDecl = LDecl->getSuperClass())) { + do { LHS = cast(getObjCInterfaceType(LDecl)); if (canAssignObjCInterfaces(LHS, RHS)) { llvm::SmallVector Protocols; @@ -4978,7 +4978,7 @@ QualType ASTContext::areCommonBaseCompatible( Result = getObjCObjectPointerType(Result); return Result; } - } + } while ((LDecl = LDecl->getSuperClass())); return QualType(); } -- cgit v1.2.3