Revert "[libc] Use best-fit binary trie to make malloc logarithmic" (#117065)
[llvm-project.git] / libcxx / test / std / numerics / complex.number / layout.pass.cpp
blobd39b2de132c1314ba468b91c4e3171d99c5c22d1
1 //===----------------------------------------------------------------------===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
9 // <complex>
11 #include <complex>
12 #include <cassert>
14 #include "test_macros.h"
16 template <class T>
17 void
18 test()
20 std::complex<T> z;
21 T* a = (T*)&z;
22 assert(0 == z.real());
23 assert(0 == z.imag());
24 assert(a[0] == z.real());
25 assert(a[1] == z.imag());
26 a[0] = 5;
27 a[1] = 6;
28 assert(a[0] == z.real());
29 assert(a[1] == z.imag());
32 int main(int, char**)
34 test<float>();
35 test<double>();
36 test<long double>();
38 return 0;