1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14, c++17
11 // Make sure that std::bit_cast works with std::complex. Test case extracted from
12 // https://github.com/llvm/llvm-project/issues/94620.
18 constexpr void test() {
19 using Complex
= std::complex<T
>;
20 unsigned char data
[sizeof(Complex
)] = {0};
22 [[maybe_unused
]] Complex c
= std::bit_cast
<Complex
>(data
);
25 constexpr bool test_all() {
32 int main(int, char**) {
34 static_assert(test_all());