Index: doc/xml/manual/intro.xml
===================================================================
--- doc/xml/manual/intro.xml (revision 136693)
+++ doc/xml/manual/intro.xml (working copy)
@@ -677,6 +677,12 @@
In C++0x mode, add std::proj.
+
+ 844:
+ complex pow return type is ambiguous
+
+ In C++0x mode, remove the pow(complex<T>, int) signature.
+
Index: include/std/complex
===================================================================
--- include/std/complex (revision 136693)
+++ include/std/complex (working copy)
@@ -82,8 +82,11 @@
template complex<_Tp> log(const complex<_Tp>&);
/// Return complex base 10 logarithm of @a z.
template complex<_Tp> log10(const complex<_Tp>&);
- /// Return complex cosine of @a z.
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+ // DR 844.
+ /// Return @a x to the @a y'th power.
template complex<_Tp> pow(const complex<_Tp>&, int);
+#endif
/// Return @a x to the @a y'th power.
template complex<_Tp> pow(const complex<_Tp>&, const _Tp&);
/// Return @a x to the @a y'th power.
@@ -945,10 +948,14 @@
// 26.2.8/9 pow(__x, __y): Returns the complex power base of __x
// raised to the __y-th power. The branch
// cut is on the negative axis.
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 844. complex pow return type is ambiguous.
template
inline complex<_Tp>
pow(const complex<_Tp>& __z, int __n)
{ return std::__pow_helper(__z, __n); }
+#endif
template
complex<_Tp>
Index: include/tr1/complex
===================================================================
--- include/tr1/complex (revision 136693)
+++ include/tr1/complex (working copy)
@@ -78,11 +78,6 @@
template
inline std::complex<_Tp>
- pow(const std::complex<_Tp>& __x, int __n)
- { return std::pow(__x, __n); }
-
- template
- inline std::complex<_Tp>
pow(const std::complex<_Tp>& __x, const _Tp& __y)
{ return std::pow(__x, __y); }
Index: testsuite/26_numerics/complex/dr844.cc
===================================================================
--- testsuite/26_numerics/complex/dr844.cc (revision 0)
+++ testsuite/26_numerics/complex/dr844.cc (revision 0)
@@ -0,0 +1,52 @@
+// { dg-options "-std=gnu++0x" }
+// 2008-06-12 Paolo Carlini
+//
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include
+#include
+#include
+
+// DR 844. complex pow return type is ambiguous.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using __gnu_test::check_ret_type;
+
+ typedef std::complex cmplx_f_type;
+ typedef std::complex cmplx_d_type;
+ typedef std::complex cmplx_ld_type;
+
+ const int i1 = 1;
+ const float f1 = 1.0f;
+ const double d1 = 1.0;
+ const long double ld1 = 1.0l;
+
+ check_ret_type(std::pow(cmplx_f_type(f1, f1), i1));
+ VERIFY( std::pow(cmplx_f_type(f1, f1), i1)
+ == std::pow(cmplx_d_type(f1, f1), double(i1)) );
+ check_ret_type(std::pow(cmplx_d_type(d1, d1), i1));
+ check_ret_type(std::pow(cmplx_ld_type(ld1, ld1), i1));
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
Index: testsuite/tr1/8_c_compatibility/complex/overloads_int.cc
===================================================================
--- testsuite/tr1/8_c_compatibility/complex/overloads_int.cc (revision 136693)
+++ testsuite/tr1/8_c_compatibility/complex/overloads_int.cc (working copy)
@@ -1,6 +1,6 @@
// 2006-01-12 Paolo Carlini
//
-// Copyright (C) 2006 Free Software Foundation, Inc.
+// Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -64,18 +64,13 @@
typedef std::complex cmplx_i_type;
check_ret_type(std::tr1::polar(i1, i1));
- // NB: According to the letter of 8.1.9/3 the return type should be a
- // cmplx_d_type, but the existing std::pow(const complex<>&, int) wins.
- // check_ret_type(std::tr1::pow(cmplx_f_type(f1, f1), i1));
- check_ret_type(std::tr1::pow(cmplx_f_type(f1, f1), i1));
-
+ check_ret_type(std::tr1::pow(cmplx_f_type(f1, f1), i1));
check_ret_type(std::tr1::pow(cmplx_f_type(f1, f1), u1));
check_ret_type(std::tr1::pow(cmplx_f_type(f1, f1), l1));
check_ret_type(std::tr1::pow(cmplx_d_type(d1, d1), i1));
- // See last comment.
- // VERIFY( std::tr1::pow(cmplx_d_type(d1, d1), i1)
- // == std::tr1::pow(cmplx_d_type(d1, d1), double(i1)) );
+ VERIFY( std::tr1::pow(cmplx_d_type(d1, d1), i1)
+ == std::tr1::pow(cmplx_d_type(d1, d1), double(i1)) );
VERIFY( std::tr1::pow(cmplx_d_type(d1, d1), u1)
== std::tr1::pow(cmplx_d_type(d1, d1), double(u1)) );
VERIFY( std::tr1::pow(cmplx_d_type(d1, d1), l1)