]>
Commit | Line | Data |
---|---|---|
e30c6e0c JW |
1 | // Use -std=c++14 explicitly, because -std=gnu++14 enables GNU extension for |
2 | // complex literals, so 1.0if is __complex__ float not std::complex<float>. | |
3 | // { dg-options "-std=c++14" } | |
ae5543e6 ESR |
4 | // { dg-do compile } |
5 | ||
83ffe9cd | 6 | // Copyright (C) 2013-2023 Free Software Foundation, Inc. |
ae5543e6 ESR |
7 | // |
8 | // This file is part of the GNU ISO C++ Library. This library is free | |
9 | // software; you can redistribute it and/or modify it under the | |
10 | // terms of the GNU General Public License as published by the | |
11 | // Free Software Foundation; either version 3, or (at your option) | |
12 | // any later version. | |
13 | ||
14 | // This library is distributed in the hope that it will be useful, | |
15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | // GNU General Public License for more details. | |
18 | ||
19 | // You should have received a copy of the GNU General Public License along | |
20 | // with this library; see the file COPYING3. If not see | |
21 | // <http://www.gnu.org/licenses/>. | |
22 | ||
23 | #include <complex> | |
24 | #include <type_traits> | |
25 | ||
26 | void | |
27 | test02() | |
28 | { | |
29 | using namespace std::literals::complex_literals; | |
30 | ||
31 | static_assert(std::is_same<decltype(1.0if), std::complex<float>>::value, | |
32 | "1.0if is std::complex<float>"); | |
33 | ||
34 | static_assert(std::is_same<decltype(1if), std::complex<float>>::value, | |
35 | "1if is std::complex<float>"); | |
36 | ||
37 | static_assert(std::is_same<decltype(1.0i), std::complex<double>>::value, | |
38 | "1.0i is std::complex<double>"); | |
39 | ||
40 | static_assert(std::is_same<decltype(1i), std::complex<double>>::value, | |
41 | "1i is std::complex<double>"); | |
42 | ||
43 | static_assert(std::is_same<decltype(1.0il), std::complex<long double>>::value, | |
44 | "1.0il is std::complex<long double>"); | |
45 | ||
46 | static_assert(std::is_same<decltype(1il), std::complex<long double>>::value, | |
47 | "1il is std::complex<long double>"); | |
48 | } |