1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
11 // template<class T> complex<T> proj(const complex<T>&);
12 // complex<long double> proj(long double);
13 // complex<double> proj(double);
14 // template<Integral T> complex<double> proj(T);
15 // complex<float> proj(float);
18 #include <type_traits>
21 #include "test_macros.h"
26 test(T x
, typename
std::enable_if
<std::is_integral
<T
>::value
>::type
* = 0)
28 static_assert((std::is_same
<decltype(std::proj(x
)), std::complex<double> >::value
), "");
29 assert(std::proj(x
) == proj(std::complex<double>(x
, 0)));
34 test(T x
, typename
std::enable_if
<std::is_floating_point
<T
>::value
>::type
* = 0)
36 static_assert((std::is_same
<decltype(std::proj(x
)), std::complex<T
> >::value
), "");
37 assert(std::proj(x
) == proj(std::complex<T
>(x
, 0)));
42 test(T x
, typename
std::enable_if
<!std::is_integral
<T
>::value
&&
43 !std::is_floating_point
<T
>::value
>::type
* = 0)
45 static_assert((std::is_same
<decltype(std::proj(x
)), std::complex<T
> >::value
), "");
46 assert(std::proj(x
) == proj(std::complex<T
>(x
, 0)));