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 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++98, c++03, c++11
13 #include <type_traits>
16 #include "test_macros.h"
20 using namespace std::literals::complex_literals
;
22 // Make sure the types are right
23 static_assert ( std::is_same
<decltype( 3.0il
), std::complex<long double>>::value
, "" );
24 static_assert ( std::is_same
<decltype( 3il
), std::complex<long double>>::value
, "" );
25 static_assert ( std::is_same
<decltype( 3.0i
), std::complex<double>>::value
, "" );
26 static_assert ( std::is_same
<decltype( 3i
), std::complex<double>>::value
, "" );
27 static_assert ( std::is_same
<decltype( 3.0if ), std::complex<float>>::value
, "" );
28 static_assert ( std::is_same
<decltype( 3if ), std::complex<float>>::value
, "" );
31 std::complex<long double> c1
= 3.0il
;
32 assert ( c1
== std::complex<long double>(0, 3.0));
38 std::complex<double> c1
= 3.0i
;
39 assert ( c1
== std::complex<double>(0, 3.0));
45 std::complex<float> c1
= 3.0if;
46 assert ( c1
== std::complex<float>(0, 3.0));