diff options
-rw-r--r-- | include/clang/AST/DeclBase.h | 6 | ||||
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 7 |
2 files changed, 7 insertions, 6 deletions
diff --git a/include/clang/AST/DeclBase.h b/include/clang/AST/DeclBase.h index b0534b8280..ecd7762468 100644 --- a/include/clang/AST/DeclBase.h +++ b/include/clang/AST/DeclBase.h @@ -762,12 +762,12 @@ protected: /// \brief Determine whether two declarations declare the same entity. inline bool declaresSameEntity(const Decl *D1, const Decl *D2) { - if (D1 == D2) - return true; - if (!D1 || !D2) return false; + if (D1 == D2) + return true; + return D1->getCanonicalDecl() == D2->getCanonicalDecl(); } diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index d0d1484dd0..cf8df57eb3 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -2262,7 +2262,7 @@ void Sema::HandleFunctionTypeMismatch(PartialDiagnostic &PDiag, } /// FunctionArgTypesAreEqual - This routine checks two function proto types -/// for equlity of their argument types. Caller has already checked that +/// for equality of their argument types. Caller has already checked that /// they have same number of arguments. This routine assumes that Objective-C /// pointer types which only differ in their protocol qualifiers are equal. /// If the parameters are different, ArgPos will have the the parameter index @@ -2300,8 +2300,9 @@ bool Sema::FunctionArgTypesAreEqual(const FunctionProtoType *OldType, ToType->getAs<ObjCObjectPointerType>()) { if (const ObjCObjectPointerType *PTFr = FromType->getAs<ObjCObjectPointerType>()) - if (declaresSameEntity(PTTo->getInterfaceDecl(), - PTFr->getInterfaceDecl())) + if (Context.hasSameUnqualifiedType( + PTTo->getObjectType()->getBaseType(), + PTFr->getObjectType()->getBaseType())) continue; } if (ArgPos) *ArgPos = O - OldType->arg_type_begin(); |