From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3369 invoked by alias); 27 Jul 2010 07:20:51 -0000 Received: (qmail 3309 invoked by uid 48); 27 Jul 2010 07:20:36 -0000 Date: Tue, 27 Jul 2010 07:20:00 -0000 Subject: [Bug libstdc++/45093] New: Different definitions of _Rb_tree::{erase,_M_destroy_node} between C++98 and C++0x X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "jyasskin at gcc dot gnu dot org" 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: 2010-07/txt/msg02931.txt.bz2 Using gold for its --detect-odr-violations: $ cat test.cc #include extern void foo(); int main() { foo(); std::map m1; m1.insert(std::make_pair(1, 2)); m1.erase(m1.begin()); } $ cat test2.cc #include void foo() { std::map 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, std::_Select1st >, std::less, std::allocator > >::_M_destroy_node(std::_Rb_tree_node >*)' 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, std::_Select1st >, std::less, std::allocator > >::erase(std::_Rb_tree_iterator >)' 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