From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id B636A139085 for ; Sun, 5 Feb 2017 20:23:51 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 58611E0D69; Sun, 5 Feb 2017 20:23:48 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 30F48E0D69 for ; Sun, 5 Feb 2017 20:23:48 +0000 (UTC) Received: from thinkpad.fritz.box (cable-static-236-115.teleport.ch [213.188.236.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: soap) by smtp.gentoo.org (Postfix) with ESMTPSA id BF6E1341667 for ; Sun, 5 Feb 2017 20:23:46 +0000 (UTC) Message-ID: <1486326221.7839.1.camel@gentoo.org> Subject: Re: [gentoo-science] -std=c++11 From: David Seifert To: gentoo-science@lists.gentoo.org Date: Sun, 05 Feb 2017 21:23:41 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.3 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-science@lists.gentoo.org Reply-to: gentoo-science@lists.gentoo.org Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Archives-Salt: ed73e1da-4aab-44a1-a7cb-1f6d7f3ce1aa X-Archives-Hash: 3300782bc31d25dc323347b520ba0f24 On Mon, 2017-02-06 at 03:17 +0700, grozin@gentoo.org wrote: > Hello *, > > Sorry, I'm not a C++ expert, and I need some help. I'm trying to > bump  > sci-mathematics/ginac and some of its revdeps. The current ginac is > 1.7.2,  > and it needs -std=c++11 (or gnu++11). I added append-cxxflags > -std=c++11  > to src_configure; also added src_test which was missing previously. > ginac  > compiles and passes tests, also ginsh works. Fine. > > The current sci-physics/nestedsums is 1.5.1, it depends on  > > =sci-mathematics/ginac-1.7 and needs -std=c++11. I've made the > > necessary  > > changes to the ebuild, it compiles and seems to work (its testsuite > is  > broken, cannot use it). Also fine. > > Then there's sci-physics/reduze. It is still 2.1, no new versions > have  > appeared. It has to be recompiles after upgrading ginac. > > If I compile it without -std=c++11, I get a lot of syntax errors in > .h  > files from ginac: > > /usr/include/ginac/ptr.h:37:13: error: expected ‘;’ at end of member  > declaration > /usr/include/ginac/ptr.h:37:15: error: ‘noexcept’ does not name a > type > /usr/include/ginac/ptr.h:57:31: error: ‘>>’ should be ‘> >’ within a  > nested template argument list > /usr/include/ginac/ptr.h:124:44: error: expected initializer before  > ‘noexcept’ > > etc. etc. > > If I compile it with -std=c++11, I get errors about operators from > stdlib: > > /var/tmp/portage/sci-physics/reduze-2.1/work/reduze- > 2.1/reduze/files.cpp:726:27:  > error: no match for ‘operator<<’ (operand types are  > ‘std::basic_ostream’ and ‘std::ofstream {aka  > std::basic_ofstream}’) > /var/tmp/portage/sci-physics/reduze-2.1/work/reduze- > 2.1/reduze/functions.h:258:46:  > error: cannot bind ‘std::basic_ostream’ lvalue to  > ‘std::basic_ostream&&’ > > etc. > > Does this mean that in order to compile it stdlib should be > recompiled  > with -std=c++11? Will it break all the other C++ packages in the > system? > > Many thanks in advance, > Andrey Dear Andrey, GCC C++ versions are in general ABI compatible, i.e. linking a package built against -std=c++98 will generally link against a package built with -std=c++11, unless you do some __cplusplus macro black magic. The error you're saying is caused by crappy code, mainly stuff such as std::cout << std::cout for instance, which is broken, wrong and overall meaningless. In C++98 this used to compile, as the void* conversion operator was implicitly called, printing the address of the std::cout global object. This conversion operator has been removed in C++11 in favour of the save bool idiom, and hence this code won't compile anymore. So: 1) You will likely require C++11 2) and you will need to fix the crappy code in sci-physics/reduze if you're on IRC, we can discuss this a bit, I don't want to litter the mailing list with tips on how to make code C++11 ready. If I have time next week I could maybe look at it. Regards David