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