From patchwork Thu Jul 25 19:49:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 261918 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 7E9D32C00E5 for ; Fri, 26 Jul 2013 05:50:03 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; q=dns; s=default; b=wvvXr6xYrXx1voSy70u05IpZ/gkZbpuDjDvWRjUPyth XqrxLRv1Va659lEepPcUAs7Yqov/J5LhZlQBcp4SQfailc44m5wYSm30kViovjjj to8uPcvgT1SJXbzYHHH0gD7gRHXKt1fC7+WBeZRNkcfLr7OignEjW+APO1cIPW4I = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; s=default; bh=vCeZxq6MV8PQHylvQaZUZC9n+FE=; b=SZD0+kEqeP2w67DQ0 gzw/Y9uX6ZK+woV8TkLklcwYtYI2CwFMq0o/i1yFKiT3pefqzxl7tXZElrxOUNtH JZQV4LEM2bYWLwTJx+BDtnflqpKH7BFaNg8AlbrxbpC29rFmlowIQNO9yuRaJGD6 e5QqV0hcqLheVrxBjZni8Cku/g= Received: (qmail 6525 invoked by alias); 25 Jul 2013 19:49:56 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 6495 invoked by uid 89); 25 Jul 2013 19:49:56 -0000 X-Spam-SWARE-Status: No, score=-3.6 required=5.0 tests=AWL, BAYES_50, RCVD_IN_DNSWL_MED, RCVD_IN_HOSTKARMA_NO, RCVD_IN_HOSTKARMA_W, RDNS_NONE, SPF_PASS, TW_PL, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-User: qpsmtpd, 2 recipients Received: from Unknown (HELO aserp1040.oracle.com) (141.146.126.69) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 25 Jul 2013 19:49:55 +0000 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r6PJniun027706 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 25 Jul 2013 19:49:45 GMT Received: from aserz7022.oracle.com (aserz7022.oracle.com [141.146.126.231]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r6PJng7O028573 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 25 Jul 2013 19:49:44 GMT Received: from abhmt109.oracle.com (abhmt109.oracle.com [141.146.116.61]) by aserz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r6PJngle028566; Thu, 25 Jul 2013 19:49:42 GMT Received: from poldo4.casa (/79.25.197.169) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 25 Jul 2013 12:49:41 -0700 Message-ID: <51F18153.1000604@oracle.com> Date: Thu, 25 Jul 2013 21:49:39 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: libstdc++ Subject: [v3] (Re-)enable pow(const complex<>&, int) in C++11 mode X-Virus-Found: No Hi, as discussed once more in the audit trail of PR57974 and agreed with Gaby I'm going to re-enable the overload. Tested x86_64-linux. Thanks, Paolo. ////////////////////// 2013-07-25 Paolo Carlini * 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. Index: doc/xml/manual/intro.xml =================================================================== --- doc/xml/manual/intro.xml (revision 201244) +++ doc/xml/manual/intro.xml (working copy) @@ -791,12 +791,6 @@ Add the overload. - 844: - complex pow return type is ambiguous - - In C++11 mode, remove the pow(complex<T>, int) signature. - - 853: to_string needs updating with zero and one Index: include/std/complex =================================================================== --- include/std/complex (revision 201244) +++ include/std/complex (working copy) @@ -88,11 +88,8 @@ template complex<_Tp> log(const complex<_Tp>&); /// Return complex base 10 logarithm of @a z. template complex<_Tp> log10(const complex<_Tp>&); -#if __cplusplus < 201103L - // 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. @@ -955,7 +952,6 @@ // 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. -#if __cplusplus < 201103L template complex<_Tp> __complex_pow_unsigned(complex<_Tp> __x, unsigned __n) @@ -972,8 +968,12 @@ 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. + // 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 inline complex<_Tp> pow(const complex<_Tp>& __z, int __n) @@ -982,7 +982,6 @@ ? complex<_Tp>(1) / std::__complex_pow_unsigned(__z, -(unsigned)__n) : std::__complex_pow_unsigned(__z, __n); } -#endif template complex<_Tp> Index: testsuite/26_numerics/complex/dr844.cc =================================================================== --- testsuite/26_numerics/complex/dr844.cc (revision 201244) +++ testsuite/26_numerics/complex/dr844.cc (working copy) @@ -22,7 +22,11 @@ #include #include +// In C++11 mode we used to implement the resolution of // 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() { bool test __attribute__((unused)) = true; @@ -37,9 +41,7 @@ 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_f_type(f1, f1), i1)); check_ret_type(std::pow(cmplx_d_type(d1, d1), i1)); check_ret_type(std::pow(cmplx_ld_type(ld1, ld1), i1)); }