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 // T 14 // imag(const complex<T>& x); 15 16 #include <complex> 17 #include <cassert> 18 19 template <class T> 20 void 21 test() 22 { 23 std::complex<T> z(1.5, 2.5); 24 assert(imag(z) == 2.5); 25 } 26 27 int main() 28 { 29 test<float>(); 30 test<double>(); 31 test<long double>(); 32 } 33