Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/bit-cast16.C

raw
1 // PR c++/114537
2 // { dg-do compile { target c++20 } }
3
4 namespace std {
5 template<typename T, typename F>
6 constexpr T
7 bit_cast (const F& f) noexcept
8 {
9 return __builtin_bit_cast (T, f);
10 }
11 }
12
13 struct A { signed char b : 1 = 0; signed char c : 7 = 0; };
14 struct D { unsigned char e; };
15 constexpr unsigned char f = std::bit_cast<D> (A{}).e;
16 static_assert (f == 0);