[clang] [Clang] Make enums trivially equality comparable (PR #133587)
Shafik Yaghmour via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 15 11:49:00 PDT 2025
================
@@ -5240,9 +5249,13 @@ static bool HasNonDeletedDefaultedEqualityComparison(Sema &S,
static bool isTriviallyEqualityComparableType(Sema &S, QualType Type, SourceLocation KeyLoc) {
QualType CanonicalType = Type.getCanonicalType();
if (CanonicalType->isIncompleteType() || CanonicalType->isDependentType() ||
- CanonicalType->isEnumeralType() || CanonicalType->isArrayType())
+ CanonicalType->isArrayType())
return false;
+ if (CanonicalType->isEnumeralType())
+ return EqualityComparisonIsDefaulted(
----------------
shafik wrote:
I am probably being dense here but I thought for the both the test cases below `EqualityComparisonIsDefaulted` would return `true` so I was asking if there is a test case in which it returns `false`.
https://github.com/llvm/llvm-project/pull/133587
More information about the cfe-commits
mailing list