Debian Codegraph @

libstdc++-v3/testsuite/20_util/bitset/operations/constexpr_c++23.cc

raw
1 // { dg-do compile { target c++23 } }
2
3 #include <bitset>
4 #include <testsuite_hooks.h>
5
6 constexpr bool
7 test()
8 {
9 std::bitset<16> b0;
10 std::bitset<16> b1 = ~b0;
11 VERIFY( b1.all() );
12 b0 &= b1;
13 VERIFY( b0.none() );
14 b0 |= b1;
15 VERIFY( b0.all() );
16 b0 ^= b1;
17 VERIFY( b0.none() );
18 b0 = b1 << 8;
19 VERIFY( !b0.all() && !b0.none() );
20 VERIFY( ((b1 << 8) | (b1 >> 8)).all() );
21 b1 <<= 8;
22 b1 >>= 8;
23 b1 >>= 8;
24 VERIFY( b1.none() );
25 VERIFY( (~b1).all() );
26 VERIFY( b1.flip().all() );
27 return true;
28 }
29
30 static_assert( test() );