//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // template // T // imag(const T& x); #include #include #include #include "test_macros.h" #include "../cases.h" template void test(typename std::enable_if::value>::type* = 0) { static_assert((std::is_same::value), ""); assert(std::imag(x) == 0); #if TEST_STD_VER > 11 constexpr T val {x}; static_assert(std::imag(val) == 0, ""); constexpr std::complex t{val, val}; static_assert(t.imag() == x, "" ); #endif } template void test(typename std::enable_if::value>::type* = 0) { static_assert((std::is_same::value), ""); assert(std::imag(x) == 0); #if TEST_STD_VER > 11 constexpr T val {x}; static_assert(std::imag(val) == 0, ""); constexpr std::complex t{val, val}; static_assert(t.imag() == x, "" ); #endif } template void test() { test(); test(); test(); } int main(int, char**) { test(); test(); test(); test(); test(); test(); return 0; }