• 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 //   bool
14 //   operator!=(const complex<T>& lhs, const complex<T>& rhs);
15 
16 #include <complex>
17 #include <cassert>
18 
19 template <class T>
20 void
test_constexpr()21 test_constexpr()
22 {
23 #if _LIBCPP_STD_VER > 11
24     {
25     constexpr std::complex<T> lhs(1.5,  2.5);
26     constexpr std::complex<T> rhs(1.5, -2.5);
27     static_assert(lhs != rhs, "");
28     }
29     {
30     constexpr std::complex<T> lhs(1.5, 2.5);
31     constexpr std::complex<T> rhs(1.5, 2.5);
32     static_assert(!(lhs != rhs), "" );
33     }
34 #endif
35 }
36 
37 
38 template <class T>
39 void
test()40 test()
41 {
42     {
43     std::complex<T> lhs(1.5,  2.5);
44     std::complex<T> rhs(1.5, -2.5);
45     assert(lhs != rhs);
46     }
47     {
48     std::complex<T> lhs(1.5, 2.5);
49     std::complex<T> rhs(1.5, 2.5);
50     assert(!(lhs != rhs));
51     }
52 
53     test_constexpr<T> ();
54     }
55 
main()56 int main()
57 {
58     test<float>();
59     test<double>();
60     test<long double>();
61 //   test_constexpr<int> ();
62 }
63