From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17935 invoked by alias); 21 May 2012 03:59:38 -0000 Received: (qmail 17924 invoked by uid 22791); 21 May 2012 03:59:37 -0000 X-SWARE-Spam-Status: No, hits=-3.6 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 21 May 2012 03:59:24 +0000 From: "jyasskin at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/53429] New: complex::{imag,real} should be marked alwaysinline to guarantee libstdc++ binary compatibility between C++98 and C++11 Date: Mon, 21 May 2012 04:03:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jyasskin at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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 X-SW-Source: 2012-05/txt/msg01968.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53429 Bug #: 53429 Summary: complex::{imag,real} should be marked alwaysinline to guarantee libstdc++ binary compatibility between C++98 and C++11 Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: jyasskin@gcc.gnu.org The non-const overloads of std::complex::real and std::complex::imag go from returning _Tp& to _Tp in C++98 vs C++11: http://gcc.gnu.org/viewcvs/trunk/libstdc%2B%2B-v3/include/std/complex?view=markup. libstdc++ includes explicit instantiations of operator<< and operator>> with complex arguments: http://gcc.gnu.org/viewcvs/trunk/libstdc%2B%2B-v3/src/c%2B%2B98/complex_io.cc?view=markup. These operator<< and operator>> overloads call complex::real() and complex::imag(). If those calls are inlined (which is likely), so that no weak definition of real() and imag() is exposed to users of the library, then I believe all is well. However, if the compiler decides not to inline them, then people linking libstdc++ from the other version of the language may wind up with two conflicting weak definitions of the symbols. I think marking them as alwaysinline would guarantee compatibility.