From 74565c3add6d683559618973863e78a5e6836e48 Mon Sep 17 00:00:00 2001 From: Chuanqi Xu Date: Thu, 23 Feb 2023 17:04:42 +0800 Subject: [PATCH] [Modules] Don't check [temp.friend]p9 in ASTContext::isSameEntity [temp.friend]p9 says > Such a constrained friend function or function template declaration does not declare the same function or function template as a declaration in any other scope. But the friend declaration in the same scope shouldn't fall into this catagory. Although the logic is handled in 'FriendsDifferByConstraints', the compiler may haven't merged the lexcial declcontext in time. Also the code removed is not covered by test too. Let's handle the logic in sema as we've done now. --- clang/lib/AST/ASTContext.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index d852ac5..11c0704 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -6687,10 +6687,6 @@ 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 -- 2.7.4