[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / numerics / complex.number / complex.member.ops / assignment_complex.pass.cpp
blob1d0e868e789a8fb28043904d544ef49fcc54b10b
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 // complex& operator=(const complex&);
12 // template<class X> complex& operator= (const complex<X>&); // constexpr in C++20
14 #include <complex>
15 #include <cassert>
17 #include "test_macros.h"
19 template <class T, class X>
20 TEST_CONSTEXPR_CXX20
21 bool
22 test()
24 std::complex<T> c;
25 assert(c.real() == 0);
26 assert(c.imag() == 0);
27 std::complex<T> c2(1.5, 2.5);
28 c = c2;
29 assert(c.real() == 1.5);
30 assert(c.imag() == 2.5);
31 std::complex<X> c3(3.5, -4.5);
32 c = c3;
33 assert(c.real() == 3.5);
34 assert(c.imag() == -4.5);
35 return true;
38 int main(int, char**)
40 test<float, float>();
41 test<float, double>();
42 test<float, long double>();
44 test<double, float>();
45 test<double, double>();
46 test<double, long double>();
48 test<long double, float>();
49 test<long double, double>();
50 test<long double, long double>();
52 #if TEST_STD_VER >= 20
53 static_assert(test<float, float>());
54 static_assert(test<float, double>());
55 static_assert(test<float, long double>());
57 static_assert(test<double, float>());
58 static_assert(test<double, double>());
59 static_assert(test<double, long double>());
61 static_assert(test<long double, float>());
62 static_assert(test<long double, double>());
63 static_assert(test<long double, long double>());
64 #endif
66 return 0;