Opened 11 years ago

Closed 9 years ago

#5774 closed Bugs (fixed)

Boost Signals 1.48 gcc 4.6.1 error

Reported by: ramon.casellas@… Owned by: Douglas Gregor
Milestone: Boost 1.49.0 Component: signals
Version: Boost Development Trunk Severity: Showstopper
Keywords: boost signals trunk error 1.48.0 Cc:

Description

Dear Boost Signals mantainer

The component no longer compiles (See error below) Ubuntu oneiric Boost trunk gcc 4.6.1 - ./b2 address-model=64 cxxflags=-std=gnu++0x

Apparently std::map expects either a map::const_iterator or a const ref to map::key,

Thank you,

R.

gcc.compile.c++ bin.v2/libs/signals/build/gcc-4.6.1/release/address-model-64/threading-multi/named_slot_map.o
libs/signals/src/named_slot_map.cpp: In member function ‘void boost::signals::detail::named_slot_map::disconnect(const boost::signals::detail::stored_group&)’:
libs/signals/src/named_slot_map.cpp:105:23: error: call of overloaded ‘erase(boost::signals::detail::named_slot_map::group_iterator&)’ is ambiguous
libs/signals/src/named_slot_map.cpp:105:23: note: candidates are:
/usr/include/c++/4.6/bits/stl_map.h:613:7: note: std::map<_Key, _Tp, _Compare, _Alloc>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::erase(std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator) [with _Key = boost::signals::detail::stored_group, _Tp = std::list<boost::signals::detail::connection_slot_pair>, _Compare = boost::function2<bool, boost::signals::detail::stored_group, boost::signals::detail::stored_group>, _Alloc = std::allocator<std::pair<const boost::signals::detail::stored_group, std::list<boost::signals::detail::connection_slot_pair> > >, std::map<_Key, _Tp, _Compare, _Alloc>::iterator = std::_Rb_tree_iterator<std::pair<const boost::signals::detail::stored_group, std::list<boost::signals::detail::connection_slot_pair> > >, std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::pair<const boost::signals::detail::stored_group, std::list<boost::signals::detail::connection_slot_pair> > >]
/usr/include/c++/4.6/bits/stl_map.h:643:7: note: std::map<_Key, _Tp, _Compare, _Alloc>::size_type std::map<_Key, _Tp, _Compare, _Alloc>::erase(const key_type&) [with _Key = boost::signals::detail::stored_group, _Tp = std::list<boost::signals::detail::connection_slot_pair>, _Compare = boost::function2<bool, boost::signals::detail::stored_group, boost::signals::detail::stored_group>, _Alloc = std::allocator<std::pair<const boost::signals::detail::stored_group, std::list<boost::signals::detail::connection_slot_pair> > >, std::map<_Key, _Tp, _Compare, _Alloc>::size_type = long unsigned int, std::map<_Key, _Tp, _Compare, _Alloc>::key_type = boost::signals::detail::stored_group]
libs/signals/src/named_slot_map.cpp: In member function ‘void boost::signals::detail::named_slot_map::remove_disconnected_slots()’:
libs/signals/src/named_slot_map.cpp:128:35: error: call of overloaded ‘erase(std::_Rb_tree_iterator<std::pair<const boost::signals::detail::stored_group, std::list<boost::signals::detail::connection_slot_pair> > >::_Self)’ is ambiguous
libs/signals/src/named_slot_map.cpp:128:35: note: candidates are:
/usr/include/c++/4.6/bits/stl_map.h:613:7: note: std::map<_Key, _Tp, _Compare, _Alloc>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::erase(std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator) [with _Key = boost::signals::detail::stored_group, _Tp = std::list<boost::signals::detail::connection_slot_pair>, _Compare = boost::function2<bool, boost::signals::detail::stored_group, boost::signals::detail::stored_group>, _Alloc = std::allocator<std::pair<const boost::signals::detail::stored_group, std::list<boost::signals::detail::connection_slot_pair> > >, std::map<_Key, _Tp, _Compare, _Alloc>::iterator = std::_Rb_tree_iterator<std::pair<const boost::signals::detail::stored_group, std::list<boost::signals::detail::connection_slot_pair> > >, std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::pair<const boost::signals::detail::stored_group, std::list<boost::signals::detail::connection_slot_pair> > >]
/usr/include/c++/4.6/bits/stl_map.h:643:7: note: std::map<_Key, _Tp, _Compare, _Alloc>::size_type std::map<_Key, _Tp, _Compare, _Alloc>::erase(const key_type&) [with _Key = boost::signals::detail::stored_group, _Tp = std::list<boost::signals::detail::connection_slot_pair>, _Compare = boost::function2<bool, boost::signals::detail::stored_group, boost::signals::detail::stored_group>, _Alloc = std::allocator<std::pair<const boost::signals::detail::stored_group, std::list<boost::signals::detail::connection_slot_pair> > >, std::map<_Key, _Tp, _Compare, _Alloc>::size_type = long unsigned int, std::map<_Key, _Tp, _Compare, _Alloc>::key_type = boost::signals::detail::stored_group]

    "g++"  -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -pthread -fPIC -m64 -std=gnu++0x -DBOOST_ALL_NO_LIB=1 -DBOOST_SIGNALS_DYN_LINK=1 -DBOOST_SIGNALS_NO_LIB=1 -DNDEBUG  -I"." -c -o "bin.v2/libs/signals/build/gcc-4.6.1/release/address-model-64/threading-multi/named_slot_map.o" "libs/signals/src/named_slot_map.cpp"

...failed gcc.compile.c++ bin.v2/libs/signals/build/gcc-4.6.1/release/address-model-64/threading-multi/named_slot_map.o...
gcc.compile.c++ bin.v2/libs/signals/build/gcc-4.6.1/release/address-model-64/threading-multi/signal_base.o
libs/signals/src/signal_base.cpp: In static member function ‘static void boost::signals::detail::signal_base_impl::slot_disconnected(void*, void*)’:
libs/signals/src/signal_base.cpp:136:37: warning: ‘auto_ptr’ is deprecated (declared at /usr/include/c++/4.6/backward/auto_ptr.h:87) [-Wdeprecated-declarations]
gcc.compile.c++ bin.v2/libs/signals/build/gcc-4.6.1/release/address-model-64/threading-multi/slot.o
...skipped <pbin.v2/libs/signals/build/gcc-4.6.1/release/address-model-64/threading-multi>libboost_signals.so.1.48.0 for lack of <pbin.v2/libs/signals/build/gcc-4.6.1/release/address-model-64/threading-multi>named_slot_map.o...
...skipped <p/adnet/boost-1.48.0/lib>libboost_signals.so.1.48.0 for lack of <pbin.v2/libs/signals/build/gcc-4.6.1/release/address-model-64/threading-multi>libboost_signals.so.1.48.0...
...skipped <p/adnet/boost-1.48.0/lib>libboost_signals.so for lack of <p/adnet/boost-1.48.0/lib>libboost_signals.so.1.48.0...

Change History (7)

comment:1 by leo goodstadt (boost <at> llew.org.uk), 11 years ago

Works with a cast:

    groups.erase(static_cast<const_group_iterator>(group));

and

    if (empty(g)) groups.erase(static_cast<const_group_iterator>(g++));

comment:2 by Ben Pope <benpope81@…>, 11 years ago

Ping.

Can this be fixed for 1.49? It's also mentioned in ticket #4999.

This failure is with both gcc-4.6.1 and clang-3.0-rc3 when -std=c++0x.

comment:3 by anonymous, 11 years ago

Apparently this is an issue with the new C++11 standard, which changed the argument type of map::erase from iterator to const_iterator. Thus the fix has to be C++11 specific.

Claas

comment:4 by kyle.tarplee@…, 11 years ago

Milestone: Boost 1.48.0Boost 1.49.0

This also breaks on clang++ with libc++.

The second fix mentioned in #4999 seems to work for me.

comment:5 by viboes, 9 years ago

Has this been fixed?

comment:6 by Ramon Casellas <ramon.casellas@…>, 9 years ago

Afaict yes, although my toolchain is now gcc 4.8.1/4.9 and 1.54. Feel free to close the ticket . Thanks, R.

comment:7 by Marshall Clow, 9 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.