Debian Codegraph @

libcxx/test/std/numerics/complex.number/complex.literals/literals2.pass.cpp

raw
1 //===----------------------------------------------------------------------===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8
9 // UNSUPPORTED: c++03, c++11
10 // <complex>
11
12 #include <complex>
13 #include <type_traits>
14 #include <cassert>
15
16 #include "test_macros.h"
17
18 int main(int, char**)
19 {
20 using namespace std;
21
22 {
23 std::complex<long double> c1 = 3.0il;
24 assert ( c1 == std::complex<long double>(0, 3.0));
25 auto c2 = 3il;
26 assert ( c1 == c2 );
27 }
28
29 {
30 std::complex<double> c1 = 3.0i;
31 assert ( c1 == std::complex<double>(0, 3.0));
32 auto c2 = 3i;
33 assert ( c1 == c2 );
34 }
35
36 {
37 std::complex<float> c1 = 3.0if;
38 assert ( c1 == std::complex<float>(0, 3.0));
39 auto c2 = 3if;
40 assert ( c1 == c2 );
41 }
42
43 return 0;
44 }