//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // template // T // real(const T& x); #include #include #include #include "../cases.h" template void test(typename std::enable_if::value>::type* = 0) { static_assert((std::is_same::value), ""); assert(std::real(x) == x); #if _LIBCPP_STD_VER > 11 constexpr T val {x}; static_assert(std::real(val) == val, ""); constexpr std::complex t{val, val}; static_assert(t.real() == x, "" ); #endif } template void test(typename std::enable_if::value>::type* = 0) { static_assert((std::is_same::value), ""); assert(std::real(x) == x); #if _LIBCPP_STD_VER > 11 constexpr T val {x}; static_assert(std::real(val) == val, ""); constexpr std::complex t{val, val}; static_assert(t.real() == x, "" ); #endif } template void test() { test(); test(); test(); } int main() { test(); test(); test(); test(); test(); test(); }