Skip to content

Commit b88af66

Browse files
authored
[libc++] Don't bother asserting that <bit> functions get unsigned types (llvm#161487)
The builtins already diagnose types other than unsigned integers, so there is no point in `static_assert`ing that again.
1 parent 32eaf5b commit b88af66

File tree

3 files changed

+0
-3
lines changed

3 files changed

+0
-3
lines changed

libcxx/include/__bit/countl.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2424

2525
template <class _Tp>
2626
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int __countl_zero(_Tp __t) _NOEXCEPT {
27-
static_assert(__is_unsigned_integer_v<_Tp>, "__countl_zero requires an unsigned integer type");
2827
return __builtin_clzg(__t, numeric_limits<_Tp>::digits);
2928
}
3029

libcxx/include/__bit/countr.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2424

2525
template <class _Tp>
2626
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __countr_zero(_Tp __t) _NOEXCEPT {
27-
static_assert(__is_unsigned_integer_v<_Tp>, "__countr_zero only works with unsigned types");
2827
return __builtin_ctzg(__t, numeric_limits<_Tp>::digits);
2928
}
3029

libcxx/include/__bit/popcount.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2323

2424
template <class _Tp>
2525
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __popcount(_Tp __t) _NOEXCEPT {
26-
static_assert(__is_unsigned_integer_v<_Tp>, "__popcount only works with unsigned types");
2726
return __builtin_popcountg(__t);
2827
}
2928

0 commit comments

Comments
 (0)