We've built up quite a few links directly to github within the code base. We should instead use `llvm.org/PR<issue-number>` to link to bugs, since that is resilient to the bug tracker changing in the future. This is especially relevant for tests linking to bugs, since they will probably be there for decades to come. A nice side effect is that these links are significantly shorter than the GH links, making them much less of an eyesore. This patch also replaces a few links that linked to the old bugzilla instance on llvm.org.
36 lines
953 B
C++
36 lines
953 B
C++
//===----------------------------------------------------------------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// UNSUPPORTED: c++03, c++11, c++14, c++17
|
|
|
|
// Make sure that std::bit_cast works with std::complex. Test case extracted from https://llvm.org/PR94620.
|
|
|
|
#include <bit>
|
|
#include <complex>
|
|
|
|
template <class T>
|
|
constexpr void test() {
|
|
using Complex = std::complex<T>;
|
|
unsigned char data[sizeof(Complex)] = {0};
|
|
|
|
[[maybe_unused]] Complex c = std::bit_cast<Complex>(data);
|
|
}
|
|
|
|
constexpr bool test_all() {
|
|
test<float>();
|
|
test<double>();
|
|
test<long double>();
|
|
return true;
|
|
}
|
|
|
|
int main(int, char**) {
|
|
test_all();
|
|
static_assert(test_all());
|
|
return 0;
|
|
}
|