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
19template <class T>
20void
21test_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
37template <class T>
38void
39test()
40{
41    {
42    std::complex<T> lhs(1.5,  2.5);
43    std::complex<T> rhs(1.5, -2.5);
44    assert( !(lhs == rhs));
45    }
46    {
47    std::complex<T> lhs(1.5, 2.5);
48    std::complex<T> rhs(1.5, 2.5);
49    assert(lhs == rhs);
50    }
51    test_constexpr<T> ();
52}
53
54int main()
55{
56    test<float>();
57    test<double>();
58    test<long double>();
59//    test_constexpr<int> ();
60}
61