llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: None (GrumpyPigSkin) <details> <summary>Changes</summary> fixes: #<!-- -->120857 where a `nullptr` access was causing a crash. @<!-- -->shafik please can you review. --- Full diff: https://github.com/llvm/llvm-project/pull/121056.diff 1 Files Affected: - (modified) clang/lib/Sema/SemaDeclCXX.cpp (+3-2) ``````````diff diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index c5a72cf812ebc9..64b1fb28e2e184 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -8871,8 +8871,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(); + if (NamedDecl* Ffd = F->getFriendDecl()) + return FD->getCanonicalDecl() == Ffd->getCanonicalDecl(); + return false; })) { Diag(FD->getLocation(), diag::err_defaulted_comparison_not_friend) << int(DCK) << int(0) << RD; `````````` </details> https://github.com/llvm/llvm-project/pull/121056 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits