diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index a1551e8027cd3..ad4a6779a1fcf 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -9039,8 +9039,7 @@ bool Sema::CheckExplicitlyDefaultedComparison(Scope *S, FunctionDecl *FD, return true; if (llvm::none_of(RD->friends(), [&](const FriendDecl *F) { - return FD->getCanonicalDecl() == - F->getFriendDecl()->getCanonicalDecl(); + return declaresSameEntity(F->getFriendDecl(), FD); })) { Diag(FD->getLocation(), diag::err_defaulted_comparison_not_friend) << int(DCK) << int(0) << RD;