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 //===----------------------------------------------------------------------===//
11 // complex& operator=(const complex&);
12 // template<class X> complex& operator= (const complex<X>&); // constexpr in C++20
17 #include "test_macros.h"
19 template <class T
, class X
>
25 assert(c
.real() == 0);
26 assert(c
.imag() == 0);
27 std::complex<T
> c2(1.5, 2.5);
29 assert(c
.real() == 1.5);
30 assert(c
.imag() == 2.5);
31 std::complex<X
> c3(3.5, -4.5);
33 assert(c
.real() == 3.5);
34 assert(c
.imag() == -4.5);
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>());