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 T& rhs);
15
16#include <complex>
17#include <cassert>
18
19#include "test_macros.h"
20
21template <class T>
22void
23test_constexpr()
24{
25#if TEST_STD_VER > 11
26    {
27    constexpr std::complex<T> lhs(1.5,  2.5);
28    constexpr T rhs(-2.5);
29    static_assert(lhs != rhs, "");
30    }
31    {
32    constexpr std::complex<T> lhs(1.5,  0);
33    constexpr T rhs(-2.5);
34    static_assert(lhs != rhs, "");
35    }
36    {
37    constexpr std::complex<T> lhs(1.5, 2.5);
38    constexpr T rhs(1.5);
39    static_assert(lhs != rhs, "");
40    }
41    {
42    constexpr std::complex<T> lhs(1.5, 0);
43    constexpr T rhs(1.5);
44    static_assert( !(lhs != rhs), "");
45    }
46#endif
47}
48
49template <class T>
50void
51test()
52{
53    {
54    std::complex<T> lhs(1.5,  2.5);
55    T rhs(-2.5);
56    assert(lhs != rhs);
57    }
58    {
59    std::complex<T> lhs(1.5,  0);
60    T rhs(-2.5);
61    assert(lhs != rhs);
62    }
63    {
64    std::complex<T> lhs(1.5, 2.5);
65    T rhs(1.5);
66    assert(lhs != rhs);
67    }
68    {
69    std::complex<T> lhs(1.5, 0);
70    T rhs(1.5);
71    assert( !(lhs != rhs));
72    }
73
74    test_constexpr<T> ();
75}
76
77int main()
78{
79    test<float>();
80    test<double>();
81    test<long double>();
82//     test_constexpr<int> ();
83    }
84