public inbox for gentoo-science@lists.gentoo.org
 help / color / mirror / Atom feed
From: David Seifert <soap@gentoo.org>
To: gentoo-science@lists.gentoo.org
Subject: Re: [gentoo-science] -std=c++11
Date: Sun, 05 Feb 2017 21:23:41 +0100	[thread overview]
Message-ID: <1486326221.7839.1.camel@gentoo.org> (raw)
In-Reply-To: <alpine.LRH.2.20.1702060042220.62380@star.inp.nsk.su>

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<char>’ and ‘std::ofstream {aka 
> std::basic_ofstream<char>}’)
> /var/tmp/portage/sci-physics/reduze-2.1/work/reduze-
> 2.1/reduze/functions.h:258:46: 
> error: cannot bind ‘std::basic_ostream<char>’ lvalue to 
> ‘std::basic_ostream<char>&&’
> 
> 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


      reply	other threads:[~2017-02-05 20:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-05 20:17 [gentoo-science] -std=c++11 grozin
2017-02-05 20:23 ` David Seifert [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1486326221.7839.1.camel@gentoo.org \
    --to=soap@gentoo.org \
    --cc=gentoo-science@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox