Skip to content

Conversation

@kazutakahirata
Copy link
Contributor

This patch replaces std::enable_if_t with std::void_t in two type
traits. Both approaches enable the template specialization if and
only if the LLVM_BITMASK_LARGEST_ENUMERATOR enumerator exists.

This patch replaces std::enable_if_t with std::void_t in two type
traits.  Both approaches enable the template specialization if and
only if the LLVM_BITMASK_LARGEST_ENUMERATOR enumerator exists.
@llvmbot
Copy link
Member

llvmbot commented Oct 22, 2025

@llvm/pr-subscribers-llvm-adt

Author: Kazu Hirata (kazutakahirata)

Changes

This patch replaces std::enable_if_t with std::void_t in two type
traits. Both approaches enable the template specialization if and
only if the LLVM_BITMASK_LARGEST_ENUMERATOR enumerator exists.


Full diff: https://github.com/llvm/llvm-project/pull/164567.diff

1 Files Affected:

  • (modified) llvm/include/llvm/ADT/BitmaskEnum.h (+2-2)
diff --git a/llvm/include/llvm/ADT/BitmaskEnum.h b/llvm/include/llvm/ADT/BitmaskEnum.h
index d464cbcfcdffd..9555fadda6e47 100644
--- a/llvm/include/llvm/ADT/BitmaskEnum.h
+++ b/llvm/include/llvm/ADT/BitmaskEnum.h
@@ -106,7 +106,7 @@ struct is_bitmask_enum : std::false_type {};
 
 template <typename E>
 struct is_bitmask_enum<
-    E, std::enable_if_t<sizeof(E::LLVM_BITMASK_LARGEST_ENUMERATOR) >= 0>>
+    E, std::void_t<decltype(E::LLVM_BITMASK_LARGEST_ENUMERATOR)>>
     : std::true_type {};
 
 /// Trait class to determine bitmask enumeration largest bit.
@@ -114,7 +114,7 @@ template <typename E, typename Enable = void> struct largest_bitmask_enum_bit;
 
 template <typename E>
 struct largest_bitmask_enum_bit<
-    E, std::enable_if_t<sizeof(E::LLVM_BITMASK_LARGEST_ENUMERATOR) >= 0>> {
+    E, std::void_t<decltype(E::LLVM_BITMASK_LARGEST_ENUMERATOR)>> {
   using UnderlyingTy = std::underlying_type_t<E>;
   static constexpr UnderlyingTy value =
       static_cast<UnderlyingTy>(E::LLVM_BITMASK_LARGEST_ENUMERATOR);

@kazutakahirata kazutakahirata merged commit 35db983 into llvm:main Oct 22, 2025
12 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_20251021_ADT_BitmaskEnum branch October 22, 2025 13:51
dvbuka pushed a commit to dvbuka/llvm-project that referenced this pull request Oct 27, 2025
This patch replaces std::enable_if_t with std::void_t in two type
traits.  Both approaches enable the template specialization if and
only if the LLVM_BITMASK_LARGEST_ENUMERATOR enumerator exists.
Lukacma pushed a commit to Lukacma/llvm-project that referenced this pull request Oct 29, 2025
This patch replaces std::enable_if_t with std::void_t in two type
traits.  Both approaches enable the template specialization if and
only if the LLVM_BITMASK_LARGEST_ENUMERATOR enumerator exists.
aokblast pushed a commit to aokblast/llvm-project that referenced this pull request Oct 30, 2025
This patch replaces std::enable_if_t with std::void_t in two type
traits.  Both approaches enable the template specialization if and
only if the LLVM_BITMASK_LARGEST_ENUMERATOR enumerator exists.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants