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