public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/45093] New: Different definitions of _Rb_tree::{erase,_M_destroy_node} between C++98 and C++0x
@ 2010-07-27 7:20 jyasskin at gcc dot gnu dot org
2010-07-27 9:42 ` [Bug libstdc++/45093] " paolo dot carlini at oracle dot com
2010-07-27 11:14 ` paolo dot carlini at oracle dot com
0 siblings, 2 replies; 3+ messages in thread
From: jyasskin at gcc dot gnu dot org @ 2010-07-27 7:20 UTC (permalink / raw)
To: gcc-bugs
Using gold for its --detect-odr-violations:
$ cat test.cc
#include <map>
extern void foo();
int main() {
foo();
std::map<int, int> m1;
m1.insert(std::make_pair(1, 2));
m1.erase(m1.begin());
}
$ cat test2.cc
#include <map>
void foo() {
std::map<int, int> m1;
m1.insert(std::make_pair(1, 2));
m1.erase(m1.begin());
}
$ ~/opensource/gcc/trunk/install/bin/g++-4.6svn -g -c -std=c++98 test.cc
$ ~/opensource/gcc/trunk/install/bin/g++-4.6svn -g -c -std=c++0x test2.cc
$ ~/opensource/gcc/trunk/install/bin/g++-4.6svn -g -std=c++0x test2.o test.o -o
test -Wl,--detect-odr-violations
.../gcc/trunk/install/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/ld:
error: while linking test: symbol 'std::_Rb_tree<int, std::pair<int const,
int>, std::_Select1st<std::pair<int const, int> >, std::less<int>,
std::allocator<std::pair<int const, int> >
>::_M_destroy_node(std::_Rb_tree_node<std::pair<int const, int> >*)' defined in
multiple places (possible ODR violation):
.../gcc/trunk/install/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../include/c++/4.6.0/bits/stl_tree.h:385
from test.o
.../gcc/trunk/install/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../include/c++/4.6.0/bits/stl_tree.h:410
from test2.o
.../gcc/trunk/install/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/ld:
error: while linking test: symbol 'std::_Rb_tree<int, std::pair<int const,
int>, std::_Select1st<std::pair<int const, int> >, std::less<int>,
std::allocator<std::pair<int const, int> >
>::erase(std::_Rb_tree_iterator<std::pair<int const, int> >)' defined in
multiple places (possible ODR violation):
.../gcc/trunk/install/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../include/c++/4.6.0/bits/stl_tree.h:1362
from test2.o
.../gcc/trunk/install/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../include/c++/4.6.0/bits/stl_tree.h:1398
from test.o
collect2: ld returned 1 exit status
$
_M_destroy_node() appears to only differ in whether some fields with trivial
destructors get destroyed, but erase() is defined with different return types
between the two versions.
So, two questions: Are -std=c++98 and -std=c++0x supposed to be
binary-compatible?
Would you accept a patch to unify the two definitions?
--
Summary: Different definitions of
_Rb_tree::{erase,_M_destroy_node} between C++98 and
C++0x
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jyasskin at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45093
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug libstdc++/45093] Different definitions of _Rb_tree::{erase,_M_destroy_node} between C++98 and C++0x
2010-07-27 7:20 [Bug libstdc++/45093] New: Different definitions of _Rb_tree::{erase,_M_destroy_node} between C++98 and C++0x jyasskin at gcc dot gnu dot org
@ 2010-07-27 9:42 ` paolo dot carlini at oracle dot com
2010-07-27 11:14 ` paolo dot carlini at oracle dot com
1 sibling, 0 replies; 3+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-07-27 9:42 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from paolo dot carlini at oracle dot com 2010-07-27 09:42 -------
Definitely they are not, **no** binary compatibility between C++98 and C++0x.
And I can tell you there are **many** more incompatibilities beyond this one
which you noticed.
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45093
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug libstdc++/45093] Different definitions of _Rb_tree::{erase,_M_destroy_node} between C++98 and C++0x
2010-07-27 7:20 [Bug libstdc++/45093] New: Different definitions of _Rb_tree::{erase,_M_destroy_node} between C++98 and C++0x jyasskin at gcc dot gnu dot org
2010-07-27 9:42 ` [Bug libstdc++/45093] " paolo dot carlini at oracle dot com
@ 2010-07-27 11:14 ` paolo dot carlini at oracle dot com
1 sibling, 0 replies; 3+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-07-27 11:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from paolo dot carlini at oracle dot com 2010-07-27 11:14 -------
Well, this specific snippet will work at some point, because we want to use
namespace association for the C++0x containers. Of course no binary
compatibility in general, C++0x and C++98 code will not be allowed in general
to interoperate, for *many* reasons (just as an example std::list will be
changed to have a constant time size in C++0x)
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45093
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-07-27 11:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-27 7:20 [Bug libstdc++/45093] New: Different definitions of _Rb_tree::{erase,_M_destroy_node} between C++98 and C++0x jyasskin at gcc dot gnu dot org
2010-07-27 9:42 ` [Bug libstdc++/45093] " paolo dot carlini at oracle dot com
2010-07-27 11:14 ` paolo dot carlini at oracle dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).