1//===----------------------------------------------------------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is dual licensed under the MIT and the University of Illinois Open 6// Source Licenses. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10// <complex> 11 12// complex& operator=(const complex&); 13// template<class X> complex& operator= (const complex<X>&); 14 15#include <complex> 16#include <cassert> 17 18template <class T, class X> 19void 20test() 21{ 22 std::complex<T> c; 23 assert(c.real() == 0); 24 assert(c.imag() == 0); 25 std::complex<T> c2(1.5, 2.5); 26 c = c2; 27 assert(c.real() == 1.5); 28 assert(c.imag() == 2.5); 29 std::complex<X> c3(3.5, -4.5); 30 c = c3; 31 assert(c.real() == 3.5); 32 assert(c.imag() == -4.5); 33} 34 35int main() 36{ 37 test<float, float>(); 38 test<float, double>(); 39 test<float, long double>(); 40 41 test<double, float>(); 42 test<double, double>(); 43 test<double, long double>(); 44 45 test<long double, float>(); 46 test<long double, double>(); 47 test<long double, long double>(); 48} 49