[PATCH] D153890: [clang] Fix checking the equality comparator of base classes in __is_trivially_equality_comparable
Nikolas Klauser via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 28 13:34:24 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3cf8b982042e: [clang] Fix checking the equality comparator of base classes in… (authored by philnik).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153890/new/
https://reviews.llvm.org/D153890
Files:
clang/lib/AST/Type.cpp
clang/test/SemaCXX/type-traits.cpp
Index: clang/test/SemaCXX/type-traits.cpp
===================================================================
--- clang/test/SemaCXX/type-traits.cpp
+++ 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
Index: clang/lib/AST/Type.cpp
===================================================================
--- clang/lib/AST/Type.cpp
+++ 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) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153890.535505.patch
Type: text/x-patch
Size: 1544 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230628/b13ef6c9/attachment-0001.bin>
More information about the cfe-commits
mailing list