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