llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Ankur Ahir (Ankur-0429) <details> <summary>Changes</summary> Fixes #<!-- -->132249 --- Full diff: https://github.com/llvm/llvm-project/pull/133878.diff 2 Files Affected: - (modified) clang/lib/Sema/SemaDeclCXX.cpp (+3-2) - (modified) clang/test/CXX/class/class.compare/class.compare.default/p1.cpp (+11) ``````````diff diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 43bf9b7cd0f95..36015a93c9728 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -9037,8 +9037,9 @@ 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 F->getFriendDecl() && + FD->getCanonicalDecl() == + F->getFriendDecl()->getCanonicalDecl(); })) { Diag(FD->getLocation(), diag::err_defaulted_comparison_not_friend) << int(DCK) << int(0) << RD; diff --git a/clang/test/CXX/class/class.compare/class.compare.default/p1.cpp b/clang/test/CXX/class/class.compare/class.compare.default/p1.cpp index a195e0548152d..37bf98be889d5 100644 --- a/clang/test/CXX/class/class.compare/class.compare.default/p1.cpp +++ b/clang/test/CXX/class/class.compare/class.compare.default/p1.cpp @@ -285,3 +285,14 @@ struct j { }; bool j::operator==(const j &) const = default; } + +namespace evil2 { + struct k {}; + + struct l { + friend bool operator==(const l& a, const l& b); + friend class k; + }; + + bool operator==(const l& a, const l& b) = default; +} `````````` </details> https://github.com/llvm/llvm-project/pull/133878 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits