diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 00b339fbc2d41d..b692e6ee06521b 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -6707,6 +6707,10 @@ bool ASTContext::isSameEntity(const NamedDecl *X, const NamedDecl *Y) const { PrimaryY->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