diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 4182986aa13a8c..482791ada5d1a0 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -6687,6 +6687,10 @@ bool ASTContext::isSameEntity(const NamedDecl *X, const NamedDecl *Y) const { FuncY->getTrailingRequiresClause())) return false; + // Constrained friends are different in certain cases, see: [temp.friend]p9. + if (FriendsDifferByConstraints(FuncX, FuncY)) + return false; + auto GetTypeAsWritten = [](const FunctionDecl *FD) { // Map to the first declaration that we've already merged into this one. // The TSI of redeclarations might not match (due to calling conventions