| 1 | // { dg-do compile { target c++20 } } |
| 2 | |
| 3 | #include <bit> |
| 4 | |
| 5 | template<typename T> constexpr bool is_int = false; |
| 6 | template<> constexpr bool is_int<int> = true; |
| 7 | |
| 8 | // LWG 3656. Inconsistent bit operations returning a count |
| 9 | // Rturn type of std::bit_width(T) changed from T to int. |
| 10 | static_assert( is_int<decltype(std::bit_width(1u))> ); |
| 11 | static_assert( is_int<decltype(std::bit_width(1ul))> ); |
| 12 | static_assert( is_int<decltype(std::bit_width(1ull))> ); |
| 13 | static_assert( is_int<decltype(std::bit_width((unsigned short)1))> ); |
| 14 | static_assert( is_int<decltype(std::bit_width((unsigned char)1))> ); |