Skip to content

Commit 911cb60

Browse files
authored
[libc++] Use __array_rank in Clang versions without any known bugs (#136103)
There was a bug in the implementation of `__array_rank` until LLVM 20 which prevented us from using the builtin. Since the bug has been fixed now we can enable the use and remove the generic implementation in a few releases.
1 parent dadea96 commit 911cb60

File tree

1 file changed

+3
-3
lines changed
  • libcxx/include/__type_traits

1 file changed

+3
-3
lines changed

libcxx/include/__type_traits/rank.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919

2020
_LIBCPP_BEGIN_NAMESPACE_STD
2121

22-
// TODO: Enable using the builtin __array_rank when https://llvm.org/PR57133 is resolved
23-
#if __has_builtin(__array_rank) && 0
22+
#if __has_builtin(__array_rank) && !defined(_LIBCPP_COMPILER_CLANG_BASED) || \
23+
(defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 2001)
2424

2525
template <class _Tp>
26-
struct rank : integral_constant<size_t, __array_rank(_Tp)> {};
26+
struct _LIBCPP_NO_SPECIALIZATIONS rank : integral_constant<size_t, __array_rank(_Tp)> {};
2727

2828
#else
2929

0 commit comments

Comments
 (0)