[libcxx-commits] [libcxx] [libc++] Fix ambiguous call in {ranges, std}::find (PR #122641)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Feb 4 20:19:01 PST 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 048f533244d537a1451ab2d2979faa762252d37d c5c8107a0167649eaab50680eb2dc3d53da0f7c6 --extensions ,cpp,h -- libcxx/test/support/sized_allocator.h libcxx/include/__algorithm/find.h libcxx/include/__bit/countr.h libcxx/include/__bit_reference libcxx/include/__fwd/bit_reference.h libcxx/test/std/algorithms/alg.nonmodifying/alg.find/find.pass.cpp libcxx/test/std/algorithms/alg.nonmodifying/alg.find/ranges.find.pass.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libcxx/include/__bit/countr.h b/libcxx/include/__bit/countr.h
index fe95e9752a..abed351fc4 100644
--- a/libcxx/include/__bit/countr.h
+++ b/libcxx/include/__bit/countr.h
@@ -53,12 +53,12 @@ template <class _Tp, __enable_if_t<is_unsigned<_Tp>::value, int> = 0>
   } else if constexpr (sizeof(_Tp) <= sizeof(unsigned long long)) {
     return std::__libcpp_ctz(static_cast<unsigned long long>(__t));
   } else {
-# if _LIBCPP_STD_VER == 11
+#  if _LIBCPP_STD_VER == 11
     // A recursive constexpr implementation for C++11
     unsigned long long __ull       = static_cast<unsigned long long>(__t);
     const unsigned int __ulldigits = numeric_limits<unsigned long long>::digits;
     return __ull == 0ull ? __ulldigits + std::__countr_zero_impl<_Tp>(__t >> __ulldigits) : std::__libcpp_ctz(__ull);
-# else
+#  else
     int __ret                      = 0;
     const unsigned int __ulldigits = numeric_limits<unsigned long long>::digits;
     while (static_cast<unsigned long long>(__t) == 0uLL) {
@@ -67,8 +67,8 @@ template <class _Tp, __enable_if_t<is_unsigned<_Tp>::value, int> = 0>
     }
     return __ret + std::__libcpp_ctz(static_cast<unsigned long long>(__t));
   }
-#endif // _LIBCPP_STD_VER == 11
-}
+#  endif // _LIBCPP_STD_VER == 11
+  }
 
 #else
 // Equivalent implementation using SFINAE-based overloading for C++03
@@ -107,14 +107,14 @@ _LIBCPP_HIDE_FROM_ABI int __countr_zero_impl(_Tp __t) _NOEXCEPT {
 
 #endif // _LIBCPP_CXX03_LANG
 
-template <class _Tp, __enable_if_t<is_unsigned<_Tp>::value, int> = 0>
-[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __countr_zero(_Tp __t) _NOEXCEPT {
+  template <class _Tp, __enable_if_t<is_unsigned<_Tp>::value, int> = 0>
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __countr_zero(_Tp __t) _NOEXCEPT {
 #if __has_builtin(__builtin_ctzg)
-  return __builtin_ctzg(__t, numeric_limits<_Tp>::digits);
+    return __builtin_ctzg(__t, numeric_limits<_Tp>::digits);
 #else
   return __t != 0 ? std::__countr_zero_impl(__t) : numeric_limits<_Tp>::digits;
 #endif
-}
+  }
 
 #if _LIBCPP_STD_VER >= 20
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/122641


More information about the libcxx-commits mailing list