From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20184 invoked by alias); 14 Jul 2014 03:41:12 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 19967 invoked by uid 48); 14 Jul 2014 03:41:02 -0000 From: "kariya_mitsuru at hotmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/61795] [C++11] return type of std::pow(std::complex, int) should be std::complex Date: Mon, 14 Jul 2014 03:41:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 4.10.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: kariya_mitsuru at hotmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-07/txt/msg00834.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61795 --- Comment #2 from Mitsuru Kariya --- I think that this behaviour is caused by r201253 (for PR57974, Comment 11). DR844 was fixed by r136694 but reverted by r201253. diff r135878 r136694 https://gcc.gnu.org/viewcvs/gcc/trunk/libstdc%2B%2B-v3/include/std/complex?r1=135878&r2=136694 diff r199924 r201253 https://gcc.gnu.org/viewcvs/gcc/trunk/libstdc%2B%2B-v3/include/std/complex?r1=199924&r2=201253 Moreover, I think that I mistook. > Note that this problem does not occur in std::complex and > std::complex because there is no difference between > C++03 and C++11. This is not true. In C++03, the 2nd argument of std::pow can cause implicit conversions. (Because it is the trivial int type.) However, I believe that it should cause no implicit conversion in C++11. (I think so from C++11 standard text quoted above.) Therefore, I think that the sample code below should be compiled successfully in C++03 mode but should cause compilation error in C++11 mode. =================================================================== #include struct S { operator int() { return 1; } }; int main() { std::complex d = std::pow(std::complex(0), S()); } ===================================================================