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 //===----------------------------------------------------------------------===// 8 9 // <complex> 10 11 // complex& operator= (const T&); 12 13 #include <complex> 14 #include <cassert> 15 16 template <class T> 17 void 18 test() 19 { 20 std::complex<T> c; 21 assert(c.real() == 0); 22 assert(c.imag() == 0); 23 c = 1.5; 24 assert(c.real() == 1.5); 25 assert(c.imag() == 0); 26 c = -1.5; 27 assert(c.real() == -1.5); 28 assert(c.imag() == 0); 29 } 30 31 int main(int, char**) 32 { 33 test<float>(); 34 test<double>(); 35 test<long double>(); 36 37 return 0; 38 } 39