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