1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
12 // template<Arithmetic T>
17 #include <type_traits>
20 #include "test_macros.h"
23 template <class T, int x>
25 test(typename std::enable_if<std::is_integral<T>::value>::type* = 0)
27 static_assert((std::is_same<decltype(std::imag(T(x))), double>::value), "");
28 assert(std::imag(x) == 0);
31 static_assert(std::imag(val) == 0, "");
32 constexpr std::complex<T> t{val, val};
33 static_assert(t.imag() == x, "" );
37 template <class T, int x>
39 test(typename std::enable_if<!std::is_integral<T>::value>::type* = 0)
41 static_assert((std::is_same<decltype(std::imag(T(x))), T>::value), "");
42 assert(std::imag(x) == 0);
45 static_assert(std::imag(val) == 0, "");
46 constexpr std::complex<T> t{val, val};
47 static_assert(t.imag() == x, "" );