[PATCH] D151623: [clang] Extend __is_trivially_equality_comparable to check for hidden friends

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 30 07:52:35 PDT 2023


erichkeane accepted this revision.
erichkeane added a comment.
This revision is now accepted and ready to land.

In D151623#4380885 <https://reviews.llvm.org/D151623#4380885>, @philnik wrote:

> In D151623#4380760 <https://reviews.llvm.org/D151623#4380760>, @erichkeane wrote:
>
>> Is this a builtin that is supposed to model something in the standard?  It isn't clear to me how this one is supposed to work.
>
> No, this is for optimization purposes. It is true when it is know that comparing two instances of T is equivalent to a `memcmp`. Or in other words every bit in the type is part of its value representation. Does that help?

I found the patch a few months ago where you added this, so I'm more knowledgeable now.



================
Comment at: clang/test/SemaCXX/type-traits.cpp:3439
+
 #endif // __cplusplus >= 202002L
 };
----------------
philnik wrote:
> erichkeane wrote:
> > Is there a reason these tests need to be c++20 only?
> Defaulted equality comparison is a C++20 feature.
Ah, right, thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151623/new/

https://reviews.llvm.org/D151623



More information about the cfe-commits mailing list