Commit 4e30cb71 by Paolo Carlini

complex (pow(const complex<>&, int)): Enable in C++11 mode too.

2013-07-25  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/std/complex (pow(const complex<>&, int)): Enable in
	C++11 mode too.
	* testsuite/26_numerics/complex/dr844.cc: Adjust.
	* doc/xml/manual/intro.xml: Update.

From-SVN: r201253
parent 41a7c215
2013-07-25 Paolo Carlini <paolo.carlini@oracle.com>
* include/std/complex (pow(const complex<>&, int)): Enable in
C++11 mode too.
* testsuite/26_numerics/complex/dr844.cc: Adjust.
* doc/xml/manual/intro.xml: Update.
2013-07-25 Tim Shen <timshen91@gmail.com> 2013-07-25 Tim Shen <timshen91@gmail.com>
Add documents and comments. Add documents and comments.
* include/bits/regex.h: Documents and comments. * include/bits/regex.h: Documents and comments.
* include/bits/regex_grep_matcher.h: Likewise. * include/bits/regex_grep_matcher.h: Likewise.
* include/bits/regex_grep_matcher.tcc: Likewise. * include/bits/regex_grep_matcher.tcc: Likewise.
* testsuite/28_regex/iterators/regex_iterator/char/string_position_01.cc: * testsuite/28_regex/iterators/regex_iterator/char/
New. string_position_01.cc: New.
2013-07-24 Paolo Carlini <paolo.carlini@oracle.com> 2013-07-24 Paolo Carlini <paolo.carlini@oracle.com>
......
...@@ -791,12 +791,6 @@ requirements of the license of GCC. ...@@ -791,12 +791,6 @@ requirements of the license of GCC.
<listitem><para>Add the overload. <listitem><para>Add the overload.
</para></listitem></varlistentry> </para></listitem></varlistentry>
<varlistentry><term><link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="../ext/lwg-defects.html#844">844</link>:
<emphasis>complex pow return type is ambiguous</emphasis>
</term>
<listitem><para>In C++11 mode, remove the pow(complex&lt;T&gt;, int) signature.
</para></listitem></varlistentry>
<varlistentry><term><link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="../ext/lwg-defects.html#853">853</link>: <varlistentry><term><link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="../ext/lwg-defects.html#853">853</link>:
<emphasis>to_string needs updating with zero and one</emphasis> <emphasis>to_string needs updating with zero and one</emphasis>
</term> </term>
......
...@@ -88,11 +88,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -88,11 +88,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Tp> complex<_Tp> log(const complex<_Tp>&); template<typename _Tp> complex<_Tp> log(const complex<_Tp>&);
/// Return complex base 10 logarithm of @a z. /// Return complex base 10 logarithm of @a z.
template<typename _Tp> complex<_Tp> log10(const complex<_Tp>&); template<typename _Tp> complex<_Tp> log10(const complex<_Tp>&);
#if __cplusplus < 201103L
// DR 844.
/// Return @a x to the @a y'th power. /// Return @a x to the @a y'th power.
template<typename _Tp> complex<_Tp> pow(const complex<_Tp>&, int); template<typename _Tp> complex<_Tp> pow(const complex<_Tp>&, int);
#endif
/// Return @a x to the @a y'th power. /// Return @a x to the @a y'th power.
template<typename _Tp> complex<_Tp> pow(const complex<_Tp>&, const _Tp&); template<typename _Tp> complex<_Tp> pow(const complex<_Tp>&, const _Tp&);
/// Return @a x to the @a y'th power. /// Return @a x to the @a y'th power.
...@@ -955,7 +952,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -955,7 +952,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// 26.2.8/9 pow(__x, __y): Returns the complex power base of __x // 26.2.8/9 pow(__x, __y): Returns the complex power base of __x
// raised to the __y-th power. The branch // raised to the __y-th power. The branch
// cut is on the negative axis. // cut is on the negative axis.
#if __cplusplus < 201103L
template<typename _Tp> template<typename _Tp>
complex<_Tp> complex<_Tp>
__complex_pow_unsigned(complex<_Tp> __x, unsigned __n) __complex_pow_unsigned(complex<_Tp> __x, unsigned __n)
...@@ -972,8 +968,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -972,8 +968,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return __y; return __y;
} }
// _GLIBCXX_RESOLVE_LIB_DEFECTS // In C++11 mode we used to implement the resolution of
// DR 844. complex pow return type is ambiguous. // DR 844. complex pow return type is ambiguous.
// thus the following overload was disabled in that mode. However, doing
// that causes all sorts of issues, see, for example:
// http://gcc.gnu.org/ml/libstdc++/2013-01/msg00058.html
// and also PR57974.
template<typename _Tp> template<typename _Tp>
inline complex<_Tp> inline complex<_Tp>
pow(const complex<_Tp>& __z, int __n) pow(const complex<_Tp>& __z, int __n)
...@@ -982,7 +982,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -982,7 +982,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
? complex<_Tp>(1) / std::__complex_pow_unsigned(__z, -(unsigned)__n) ? complex<_Tp>(1) / std::__complex_pow_unsigned(__z, -(unsigned)__n)
: std::__complex_pow_unsigned(__z, __n); : std::__complex_pow_unsigned(__z, __n);
} }
#endif
template<typename _Tp> template<typename _Tp>
complex<_Tp> complex<_Tp>
......
...@@ -22,7 +22,11 @@ ...@@ -22,7 +22,11 @@
#include <testsuite_hooks.h> #include <testsuite_hooks.h>
#include <testsuite_tr1.h> #include <testsuite_tr1.h>
// In C++11 mode we used to implement the resolution of
// DR 844. complex pow return type is ambiguous. // DR 844. complex pow return type is ambiguous.
// However, doing that causes all sorts of issues, see, for example:
// http://gcc.gnu.org/ml/libstdc++/2013-01/msg00058.html
// and also PR57974.
void test01() void test01()
{ {
bool test __attribute__((unused)) = true; bool test __attribute__((unused)) = true;
...@@ -37,9 +41,7 @@ void test01() ...@@ -37,9 +41,7 @@ void test01()
const double d1 = 1.0; const double d1 = 1.0;
const long double ld1 = 1.0l; const long double ld1 = 1.0l;
check_ret_type<cmplx_d_type>(std::pow(cmplx_f_type(f1, f1), i1)); check_ret_type<cmplx_f_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<cmplx_d_type>(std::pow(cmplx_d_type(d1, d1), i1)); check_ret_type<cmplx_d_type>(std::pow(cmplx_d_type(d1, d1), i1));
check_ret_type<cmplx_ld_type>(std::pow(cmplx_ld_type(ld1, ld1), i1)); check_ret_type<cmplx_ld_type>(std::pow(cmplx_ld_type(ld1, ld1), i1));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment