1243730Srwatson// { dg-options "-std=gnu++0x" }
2243730Srwatson// 2008-06-12  Paolo Carlini  <paolo.carlini@oracle.com>
3243730Srwatson//
4243730Srwatson// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
5243730Srwatson//
6243730Srwatson// This file is part of the GNU ISO C++ Library.  This library is free
7243730Srwatson// software; you can redistribute it and/or modify it under the
8243730Srwatson// terms of the GNU General Public License as published by the
9243730Srwatson// Free Software Foundation; either version 3, or (at your option)
10243730Srwatson// any later version.
11243730Srwatson//
12243730Srwatson// This library is distributed in the hope that it will be useful,
13243730Srwatson// but WITHOUT ANY WARRANTY; without even the implied warranty of
14243730Srwatson// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15243730Srwatson// GNU General Public License for more details.
16243730Srwatson//
17243730Srwatson// You should have received a copy of the GNU General Public License along
18243730Srwatson// with this library; see the file COPYING3.  If not see
19243730Srwatson// <http://www.gnu.org/licenses/>.
20243730Srwatson
21243730Srwatson#include <complex>
22243730Srwatson#include <testsuite_hooks.h>
23243730Srwatson#include <testsuite_tr1.h>
24243730Srwatson
25243730Srwatson// DR 844. complex pow return type is ambiguous.
26243730Srwatsonvoid test01()
27243730Srwatson{
28243730Srwatson  bool test __attribute__((unused)) = true;
29243730Srwatson  using __gnu_test::check_ret_type;
30243734Srwatson
31243730Srwatson  typedef std::complex<float>       cmplx_f_type;
32243730Srwatson  typedef std::complex<double>      cmplx_d_type;
33243730Srwatson  typedef std::complex<long double> cmplx_ld_type;
34243730Srwatson
35243730Srwatson  const int          i1 = 1;
36243730Srwatson  const float        f1 = 1.0f;
37243730Srwatson  const double       d1 = 1.0;
38243730Srwatson  const long double ld1 = 1.0l;
39243730Srwatson
40243730Srwatson  check_ret_type<cmplx_d_type>(std::pow(cmplx_f_type(f1, f1), i1));
41243730Srwatson  VERIFY( std::pow(cmplx_f_type(f1, f1), i1)
42243730Srwatson	  == std::pow(cmplx_d_type(f1, f1), double(i1)) );
43243730Srwatson  check_ret_type<cmplx_d_type>(std::pow(cmplx_d_type(d1, d1), i1));
44243730Srwatson  check_ret_type<cmplx_ld_type>(std::pow(cmplx_ld_type(ld1, ld1), i1));
45243730Srwatson}
46243730Srwatson
47243730Srwatsonint main()
48243730Srwatson{
49243730Srwatson  test01();
50243730Srwatson  return 0;
51243730Srwatson}
52243730Srwatson