]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_float.cc
Update copyright years in libstdc++-v3/
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / tr1 / 8_c_compatibility / complex / overloads_float.cc
CommitLineData
3577e3ea
PC
1// { dg-do compile }
2
90922b2d
PC
3// 2006-01-12 Paolo Carlini <pcarlini@suse.de>
4//
aa118a03 5// Copyright (C) 2006-2014 Free Software Foundation, Inc.
90922b2d
PC
6//
7// This file is part of the GNU ISO C++ Library. This library is free
8// software; you can redistribute it and/or modify it under the
9// terms of the GNU General Public License as published by the
748086b7 10// Free Software Foundation; either version 3, or (at your option)
90922b2d
PC
11// any later version.
12//
13// This library is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU General Public License for more details.
17//
18// You should have received a copy of the GNU General Public License along
748086b7
JJ
19// with this library; see the file COPYING3. If not see
20// <http://www.gnu.org/licenses/>.
90922b2d
PC
21
22// 8.1 Additions to header <complex>
23
24#include <tr1/complex>
90922b2d
PC
25#include <testsuite_tr1.h>
26
27void test01()
28{
9a7ab578 29 using __gnu_test::check_ret_type;
90922b2d
PC
30
31 typedef std::complex<float> cmplx_f_type;
32 typedef std::complex<double> cmplx_d_type;
33 typedef std::complex<long double> cmplx_ld_type;
34
35 const float f1 = 1.0f;
36 const double d1 = 1.0;
37 const long double ld1 = 1.0l;
38
39 const cmplx_f_type c_f1(f1, f1);
40 const cmplx_d_type c_d1(d1, d1);
41 const cmplx_ld_type c_ld1(ld1, ld1);
42
9a7ab578
PC
43 check_ret_type<float>(std::tr1::arg(f1));
44 check_ret_type<double>(std::tr1::arg(d1));
45 check_ret_type<long double>(std::tr1::arg(ld1));
90922b2d 46
9a7ab578
PC
47 check_ret_type<cmplx_f_type>(std::tr1::conj(f1));
48 check_ret_type<cmplx_d_type>(std::tr1::conj(d1));
49 check_ret_type<cmplx_ld_type>(std::tr1::conj(ld1));
90922b2d 50
9a7ab578
PC
51 check_ret_type<float>(std::tr1::imag(f1));
52 check_ret_type<double>(std::tr1::imag(d1));
53 check_ret_type<long double>(std::tr1::imag(ld1));
90922b2d 54
9a7ab578
PC
55 check_ret_type<float>(std::tr1::norm(f1));
56 check_ret_type<double>(std::tr1::norm(d1));
57 check_ret_type<long double>(std::tr1::norm(ld1));
90922b2d 58
9a7ab578
PC
59 check_ret_type<cmplx_f_type>(std::tr1::polar(f1, f1));
60 check_ret_type<cmplx_d_type>(std::tr1::polar(d1, f1));
61 check_ret_type<cmplx_d_type>(std::tr1::polar(f1, d1));
62 check_ret_type<cmplx_d_type>(std::tr1::polar(d1, d1));
63 check_ret_type<cmplx_ld_type>(std::tr1::polar(ld1, d1));
64 check_ret_type<cmplx_ld_type>(std::tr1::polar(d1, ld1));
65 check_ret_type<cmplx_ld_type>(std::tr1::polar(ld1, f1));
66 check_ret_type<cmplx_ld_type>(std::tr1::polar(f1, ld1));
67 check_ret_type<cmplx_ld_type>(std::tr1::polar(ld1, ld1));
90922b2d 68
9a7ab578
PC
69 check_ret_type<cmplx_f_type>(std::tr1::pow(c_f1, f1));
70 check_ret_type<cmplx_d_type>(std::tr1::pow(c_d1, f1));
71 check_ret_type<cmplx_d_type>(std::tr1::pow(c_f1, d1));
72 check_ret_type<cmplx_d_type>(std::tr1::pow(c_d1, d1));
73 check_ret_type<cmplx_ld_type>(std::tr1::pow(c_ld1, d1));
74 check_ret_type<cmplx_ld_type>(std::tr1::pow(c_d1, ld1));
75 check_ret_type<cmplx_ld_type>(std::tr1::pow(c_ld1, f1));
76 check_ret_type<cmplx_ld_type>(std::tr1::pow(c_f1, ld1));
77 check_ret_type<cmplx_ld_type>(std::tr1::pow(c_ld1, ld1));
90922b2d 78
9a7ab578
PC
79 check_ret_type<cmplx_f_type>(std::tr1::pow(f1, c_f1));
80 check_ret_type<cmplx_d_type>(std::tr1::pow(d1, c_f1));
81 check_ret_type<cmplx_d_type>(std::tr1::pow(f1, c_d1));
82 check_ret_type<cmplx_d_type>(std::tr1::pow(d1, c_d1));
83 check_ret_type<cmplx_ld_type>(std::tr1::pow(ld1, c_d1));
84 check_ret_type<cmplx_ld_type>(std::tr1::pow(d1, c_ld1));
85 check_ret_type<cmplx_ld_type>(std::tr1::pow(ld1, c_f1));
86 check_ret_type<cmplx_ld_type>(std::tr1::pow(f1, c_ld1));
87 check_ret_type<cmplx_ld_type>(std::tr1::pow(ld1, c_ld1));
90922b2d 88
9a7ab578
PC
89 check_ret_type<cmplx_f_type>(std::tr1::pow(c_f1, c_f1));
90 check_ret_type<cmplx_d_type>(std::tr1::pow(c_d1, c_f1));
91 check_ret_type<cmplx_d_type>(std::tr1::pow(c_f1, c_d1));
92 check_ret_type<cmplx_d_type>(std::tr1::pow(c_d1, c_d1));
93 check_ret_type<cmplx_ld_type>(std::tr1::pow(c_ld1, c_d1));
94 check_ret_type<cmplx_ld_type>(std::tr1::pow(c_d1, c_ld1));
95 check_ret_type<cmplx_ld_type>(std::tr1::pow(c_ld1, c_f1));
96 check_ret_type<cmplx_ld_type>(std::tr1::pow(c_f1, c_ld1));
97 check_ret_type<cmplx_ld_type>(std::tr1::pow(c_ld1, c_ld1));
90922b2d 98
9a7ab578
PC
99 check_ret_type<float>(std::tr1::real(f1));
100 check_ret_type<double>(std::tr1::real(d1));
101 check_ret_type<long double>(std::tr1::real(ld1));
90922b2d 102}