// { dg-do compile { target c++20 } } // PR libstdc++/105027 - Missing constraints on std::bit_cast #include template concept BitCastable = requires(const U& u) { std::bit_cast(u); }; static_assert(BitCastable); // OK static_assert(!BitCastable); // #1: different size struct A { A(A const&); int i; }; static_assert(!BitCastable); // #2: not trivially copyable static_assert(!BitCastable); // #3: sizeof(int()) is ill-formed