//===----------------------------------------------------------------------===// // // 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 complex conj(const complex&); // constexpr in C++20 // complex conj(long double); // constexpr in C++20 // complex conj(double); // constexpr in C++20 // template complex conj(T); // constexpr in C++20 // complex conj(float); // constexpr in C++20 #include #include #include #include "test_macros.h" #include "../cases.h" template TEST_CONSTEXPR_CXX20 void test(T x, typename std::enable_if::value>::type* = 0) { static_assert((std::is_same >::value), ""); assert(std::conj(x) == conj(std::complex(x, 0))); } template TEST_CONSTEXPR_CXX20 void test(T x, typename std::enable_if::value>::type* = 0) { static_assert((std::is_same >::value), ""); assert(std::conj(x) == conj(std::complex(x, 0))); } template TEST_CONSTEXPR_CXX20 void test(T x, typename std::enable_if::value && !std::is_floating_point::value>::type* = 0) { static_assert((std::is_same >::value), ""); assert(std::conj(x) == conj(std::complex(x, 0))); } template TEST_CONSTEXPR_CXX20 bool test() { test(0); test(1); test(10); return true; } int main(int, char**) { test(); test(); test(); test(); test(); test(); #if TEST_STD_VER >= 20 static_assert(test()); static_assert(test()); static_assert(test()); static_assert(test()); static_assert(test()); static_assert(test()); #endif return 0; }