[llvm] [ADT] Make `is_scoped_enum_v` SFINAE-able (PR #138134)
via llvm-commits
llvm-commits at lists.llvm.org
Thu May 1 06:53:24 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-adt
Author: Vlad Serebrennikov (Endilll)
<details>
<summary>Changes</summary>
...in old compilers where `std::underlying_type` is not SFINAE-friendly. Fixes buildbot failure https://lab.llvm.org/buildbot/#/builders/134/builds/17904 caused by #<!-- -->138089. Demo: https://godbolt.org/z/1dj5Ysn8E
---
Full diff: https://github.com/llvm/llvm-project/pull/138134.diff
1 Files Affected:
- (modified) llvm/include/llvm/ADT/STLForwardCompat.h (+2-1)
``````````diff
diff --git a/llvm/include/llvm/ADT/STLForwardCompat.h b/llvm/include/llvm/ADT/STLForwardCompat.h
index b8d4babc95fea..c70f4dc29aee0 100644
--- a/llvm/include/llvm/ADT/STLForwardCompat.h
+++ b/llvm/include/llvm/ADT/STLForwardCompat.h
@@ -73,7 +73,8 @@ struct from_range_t {
};
inline constexpr from_range_t from_range{};
-template <typename T, typename UnderlyingT = std::underlying_type_t<T>>
+template <typename T, typename UnderlyingT = typename std::enable_if_t<
+ std::is_enum_v<T>, std::underlying_type<T>>::type>
constexpr bool is_scoped_enum_v =
std::is_enum_v<T> && !std::is_convertible_v<T, UnderlyingT>;
``````````
</details>
https://github.com/llvm/llvm-project/pull/138134
More information about the llvm-commits
mailing list