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 @@ -2663,7 +2663,8 @@ return false; } - return Context.hasUniqueObjectRepresentations(CanonicalType); + return Context.hasUniqueObjectRepresentations( + CanonicalType, /*CheckIfTriviallyCopyable=*/false); } bool QualType::isNonWeakInMRRWithObjCWeak(const ASTContext &Context) const { 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 @@ -3134,6 +3134,14 @@ }; static_assert(__is_trivially_equality_comparable(TriviallyEqualityComparable), ""); +struct TriviallyEqualityComparableNonTriviallyCopyable { + TriviallyEqualityComparableNonTriviallyCopyable(const TriviallyEqualityComparableNonTriviallyCopyable&); + ~TriviallyEqualityComparableNonTriviallyCopyable(); + bool operator==(const TriviallyEqualityComparableNonTriviallyCopyable&) const = default; + int i; +}; +static_assert(__is_trivially_equality_comparable(TriviallyEqualityComparableNonTriviallyCopyable)); + struct NotTriviallyEqualityComparableHasPadding { short i; int j;