[llvm] [ADT] Document C++20 migration path for llvm::is_detected (PR #164363)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 20 22:59:39 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-adt
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
The C++20 standard has adopted concepts and requires clauses as a
superior alternative to std::is_detected.
This patch adds a comment for llvm::is_detected to document this
relationship. The utility is kept in STLForwardCompat.h to serve as a
marker to migrate usages of llvm::is_detected to concepts and
requires clauses when the codebase adopts C++20.
---
Full diff: https://github.com/llvm/llvm-project/pull/164363.diff
1 Files Affected:
- (modified) llvm/include/llvm/ADT/STLForwardCompat.h (+7)
``````````diff
diff --git a/llvm/include/llvm/ADT/STLForwardCompat.h b/llvm/include/llvm/ADT/STLForwardCompat.h
index 0e9bd2d455965..9c81981534506 100644
--- a/llvm/include/llvm/ADT/STLForwardCompat.h
+++ b/llvm/include/llvm/ADT/STLForwardCompat.h
@@ -115,6 +115,13 @@ struct detector<std::void_t<Op<Args...>>, Op, Args...> {
/// using has_copy_assign_t = decltype(std::declval<T&>()
/// = std::declval<const T&>());
/// bool fooHasCopyAssign = is_detected<has_copy_assign_t, FooClass>::value;
+///
+/// NOTE: The C++20 standard has adopted concepts and requires clauses as a
+/// superior alternative to std::is_detected.
+///
+/// This utility is placed in STLForwardCompat.h as a reminder
+/// to migrate usages of llvm::is_detected to concepts and 'requires'
+/// clauses when the codebase adopts C++20.
template <template <class...> class Op, class... Args>
using is_detected = typename detail::detector<void, Op, Args...>::value_t;
``````````
</details>
https://github.com/llvm/llvm-project/pull/164363
More information about the llvm-commits
mailing list