15a83710eSEric Fiselier //===----------------------------------------------------------------------===//
25a83710eSEric Fiselier //
357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
65a83710eSEric Fiselier //
75a83710eSEric Fiselier //===----------------------------------------------------------------------===//
85a83710eSEric Fiselier 
95a83710eSEric Fiselier // <complex>
105a83710eSEric Fiselier 
115a83710eSEric Fiselier // complex& operator=(const complex&);
125a83710eSEric Fiselier // template<class X> complex& operator= (const complex<X>&);
135a83710eSEric Fiselier 
145a83710eSEric Fiselier #include <complex>
155a83710eSEric Fiselier #include <cassert>
165a83710eSEric Fiselier 
17*7fc6a556SMarshall Clow #include "test_macros.h"
18*7fc6a556SMarshall Clow 
195a83710eSEric Fiselier template <class T, class X>
205a83710eSEric Fiselier void
test()215a83710eSEric Fiselier test()
225a83710eSEric Fiselier {
235a83710eSEric Fiselier     std::complex<T> c;
245a83710eSEric Fiselier     assert(c.real() == 0);
255a83710eSEric Fiselier     assert(c.imag() == 0);
265a83710eSEric Fiselier     std::complex<T> c2(1.5, 2.5);
275a83710eSEric Fiselier     c = c2;
285a83710eSEric Fiselier     assert(c.real() == 1.5);
295a83710eSEric Fiselier     assert(c.imag() == 2.5);
305a83710eSEric Fiselier     std::complex<X> c3(3.5, -4.5);
315a83710eSEric Fiselier     c = c3;
325a83710eSEric Fiselier     assert(c.real() == 3.5);
335a83710eSEric Fiselier     assert(c.imag() == -4.5);
345a83710eSEric Fiselier }
355a83710eSEric Fiselier 
main(int,char **)362df59c50SJF Bastien int main(int, char**)
375a83710eSEric Fiselier {
385a83710eSEric Fiselier     test<float, float>();
395a83710eSEric Fiselier     test<float, double>();
405a83710eSEric Fiselier     test<float, long double>();
415a83710eSEric Fiselier 
425a83710eSEric Fiselier     test<double, float>();
435a83710eSEric Fiselier     test<double, double>();
445a83710eSEric Fiselier     test<double, long double>();
455a83710eSEric Fiselier 
465a83710eSEric Fiselier     test<long double, float>();
475a83710eSEric Fiselier     test<long double, double>();
485a83710eSEric Fiselier     test<long double, long double>();
492df59c50SJF Bastien 
502df59c50SJF Bastien   return 0;
515a83710eSEric Fiselier }
52