diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp --- a/clang/lib/AST/Type.cpp +++ b/clang/lib/AST/Type.cpp @@ -2667,7 +2667,7 @@ return llvm::all_of(Decl->bases(), [](const CXXBaseSpecifier &BS) { if (const auto *RD = BS.getType()->getAsCXXRecordDecl()) - HasNonDeletedDefaultedEqualityComparison(RD); + return HasNonDeletedDefaultedEqualityComparison(RD); return true; }) && llvm::all_of(Decl->fields(), [](const FieldDecl *FD) { diff --git a/clang/test/SemaCXX/type-traits.cpp b/clang/test/SemaCXX/type-traits.cpp --- a/clang/test/SemaCXX/type-traits.cpp +++ b/clang/test/SemaCXX/type-traits.cpp @@ -3264,6 +3264,21 @@ }; static_assert(!__is_trivially_equality_comparable(NotTriviallyEqualityComparableHasReferenceMember)); +struct NotTriviallyEqualityComparableNonTriviallyComparableBaseBase { + int i; + + bool operator==(const NotTriviallyEqualityComparableNonTriviallyComparableBaseBase&) const { + return true; + } +}; + +struct NotTriviallyEqualityComparableNonTriviallyComparableBase : NotTriviallyEqualityComparableNonTriviallyComparableBaseBase { + int i; + + bool operator==(const NotTriviallyEqualityComparableNonTriviallyComparableBase&) const = default; +}; +static_assert(!__is_trivially_equality_comparable(NotTriviallyEqualityComparableNonTriviallyComparableBase)); + enum E { a, b