* [gentoo-science] -std=c++11
@ 2017-02-05 20:17 grozin
2017-02-05 20:23 ` David Seifert
0 siblings, 1 reply; 2+ messages in thread
From: grozin @ 2017-02-05 20:17 UTC (permalink / raw
To: gentoo-science
[-- Attachment #1: Type: text/plain, Size: 1812 bytes --]
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [gentoo-science] -std=c++11
2017-02-05 20:17 [gentoo-science] -std=c++11 grozin
@ 2017-02-05 20:23 ` David Seifert
0 siblings, 0 replies; 2+ messages in thread
From: David Seifert @ 2017-02-05 20:23 UTC (permalink / raw
To: gentoo-science
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-02-05 20:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-05 20:17 [gentoo-science] -std=c++11 grozin
2017-02-05 20:23 ` David Seifert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox