[libcxx-commits] [PATCH] D143447: [libc++] Implement P1328R1 constexpr std::type_info::operator==

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Feb 7 00:56:45 PST 2023


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

LGTM, modulo some nits.



================
Comment at: libcxx/include/typeinfo:112
+      // from different translation units, so it is sufficient to compare their addresses.
+      if (__libcpp_is_constant_evaluated()) {
+        return this == &__arg;
----------------
Just curious, but why `__libcpp_is_constant_evaluated` instead of `std::is_constant_evaluated`?


================
Comment at: libcxx/include/typeinfo:113
+      if (__libcpp_is_constant_evaluated()) {
+        return this == &__arg;
+      }
----------------



================
Comment at: libcxx/test/std/language.support/support.rtti/type.info/type_info.equal.pass.cpp:11
+//
+//  bool operator==(const type_info& rhs) const noexcept; // constexpr since C++23
+
----------------
Can you add a test for `noexcept` too?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143447



More information about the libcxx-commits mailing list