| 1 | // { dg-do compile } |
| 2 | // { dg-require-normal-namespace "" } |
| 3 | |
| 4 | // Copyright (C) 2007-2025 Free Software Foundation, Inc. |
| 5 | // |
| 6 | // This file is part of the GNU ISO C++ Library. This library is free |
| 7 | // software; you can redistribute it and/or modify it under the |
| 8 | // terms of the GNU General Public License as published by the |
| 9 | // Free Software Foundation; either version 3, or (at your option) |
| 10 | // any later version. |
| 11 | |
| 12 | // This library is distributed in the hope that it will be useful, |
| 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | // GNU General Public License for more details. |
| 16 | |
| 17 | // You should have received a copy of the GNU General Public License along |
| 18 | // with this library; see the file COPYING3. If not see |
| 19 | // <http://www.gnu.org/licenses/>. |
| 20 | |
| 21 | #include <complex> |
| 22 | |
| 23 | namespace std { |
| 24 | template<class T> class complex; |
| 25 | template<> class complex<float>; |
| 26 | template<> class complex<double>; |
| 27 | template<> class complex<long double>; |
| 28 | |
| 29 | // 26.2.6 operators: |
| 30 | template<class T> |
| 31 | _GLIBCXX20_CONSTEXPR complex<T> |
| 32 | operator+(const complex<T>&, const complex<T>&); |
| 33 | template<class T> |
| 34 | _GLIBCXX20_CONSTEXPR complex<T> operator+(const complex<T>&, const T&); |
| 35 | template<class T> |
| 36 | _GLIBCXX20_CONSTEXPR complex<T> operator+(const T&, const complex<T>&); |
| 37 | |
| 38 | template<class T> |
| 39 | _GLIBCXX20_CONSTEXPR complex<T> |
| 40 | operator-(const complex<T>&, const complex<T>&); |
| 41 | template<class T> |
| 42 | _GLIBCXX20_CONSTEXPR complex<T> operator-(const complex<T>&, const T&); |
| 43 | template<class T> |
| 44 | _GLIBCXX20_CONSTEXPR complex<T> operator-(const T&, const complex<T>&); |
| 45 | |
| 46 | template<class T> |
| 47 | _GLIBCXX20_CONSTEXPR complex<T> operator* |
| 48 | (const complex<T>&, const complex<T>&); |
| 49 | template<class T> |
| 50 | _GLIBCXX20_CONSTEXPR complex<T> operator*(const complex<T>&, const T&); |
| 51 | template<class T> |
| 52 | _GLIBCXX20_CONSTEXPR complex<T> operator*(const T&, const complex<T>&); |
| 53 | |
| 54 | template<class T> |
| 55 | _GLIBCXX20_CONSTEXPR complex<T> |
| 56 | operator/(const complex<T>&, const complex<T>&); |
| 57 | template<class T> |
| 58 | _GLIBCXX20_CONSTEXPR complex<T> operator/(const complex<T>&, const T&); |
| 59 | template<class T> |
| 60 | _GLIBCXX20_CONSTEXPR complex<T> operator/(const T&, const complex<T>&); |
| 61 | |
| 62 | template<class T> |
| 63 | _GLIBCXX20_CONSTEXPR complex<T> operator+(const complex<T>&); |
| 64 | template<class T> |
| 65 | _GLIBCXX20_CONSTEXPR complex<T> operator-(const complex<T>&); |
| 66 | |
| 67 | template<class T> |
| 68 | _GLIBCXX_CONSTEXPR bool operator==(const complex<T>&, const complex<T>&); |
| 69 | template<class T> |
| 70 | _GLIBCXX_CONSTEXPR bool operator==(const complex<T>&, const T&); |
| 71 | template<class T> |
| 72 | _GLIBCXX_CONSTEXPR bool operator==(const T&, const complex<T>&); |
| 73 | |
| 74 | template<class T> |
| 75 | _GLIBCXX_CONSTEXPR bool operator!=(const complex<T>&, const complex<T>&); |
| 76 | template<class T> |
| 77 | _GLIBCXX_CONSTEXPR bool operator!=(const complex<T>&, const T&); |
| 78 | template<class T> |
| 79 | _GLIBCXX_CONSTEXPR bool operator!=(const T&, const complex<T>&); |
| 80 | |
| 81 | template<class T, class charT, class traits> |
| 82 | basic_istream<charT, traits>& |
| 83 | operator>>(basic_istream<charT, traits>&, complex<T>&); |
| 84 | template<class T, class charT, class traits> |
| 85 | basic_ostream<charT, traits>& |
| 86 | operator<<(basic_ostream<charT, traits>&, const complex<T>&); |
| 87 | |
| 88 | // 26.2.7 values: |
| 89 | template<class T> _GLIBCXX_CONSTEXPR T real(const complex<T>&); |
| 90 | template<class T> _GLIBCXX_CONSTEXPR T imag(const complex<T>&); |
| 91 | template<class T> T abs(const complex<T>&); |
| 92 | template<class T> T arg(const complex<T>&); |
| 93 | template<class T> _GLIBCXX20_CONSTEXPR T norm(const complex<T>&); |
| 94 | template<class T> _GLIBCXX20_CONSTEXPR complex<T> conj(const complex<T>&); |
| 95 | template<class T> complex<T> proj(const complex<T>&); |
| 96 | template<class T> complex<T> polar(const T& rho, const T& theta); |
| 97 | |
| 98 | // 26.2.8 transcendentals: |
| 99 | template<class T> complex<T> cos(const complex<T>&); |
| 100 | template<class T> complex<T> cosh(const complex<T>&); |
| 101 | template<class T> complex<T> exp(const complex<T>&); |
| 102 | template<class T> complex<T> log(const complex<T>&); |
| 103 | template<class T> complex<T> log10(const complex<T>&); |
| 104 | template<class T> complex<T> pow(const complex<T>&, int); |
| 105 | template<class T> complex<T> pow(const complex<T>&, const T&); |
| 106 | template<class T> complex<T> pow(const complex<T>&, const complex<T>&); |
| 107 | template<class T> complex<T> pow(const T&, const complex<T>&); |
| 108 | template<class T> complex<T> sin (const complex<T>&); |
| 109 | template<class T> complex<T> sinh(const complex<T>&); |
| 110 | template<class T> complex<T> sqrt(const complex<T>&); |
| 111 | template<class T> complex<T> tan(const complex<T>&); |
| 112 | template<class T> complex<T> tanh(const complex<T>&); |
| 113 | } |