[clang] 74565c3 - [Modules] Don't check [temp.friend]p9 in ASTContext::isSameEntity

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 23 01:10:26 PST 2023


Author: Chuanqi Xu
Date: 2023-02-23T17:09:38+08:00
New Revision: 74565c3add6d683559618973863e78a5e6836e48

URL: https://github.com/llvm/llvm-project/commit/74565c3add6d683559618973863e78a5e6836e48
DIFF: https://github.com/llvm/llvm-project/commit/74565c3add6d683559618973863e78a5e6836e48.diff

LOG: [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.

Added: 
    

Modified: 
    clang/lib/AST/ASTContext.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index d852ac52ce8c..11c07043c984 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 
diff erent 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


        


More information about the cfe-commits mailing list