Boost.Statechart: Cannot compile example with GCC 4.0.2?

Hi all, I'm trying to compile the StopWatch.cpp example on SuSE10 and I'm getting a whole bunch of errors (or at least what gcc thinks are errors): $ gcc --version gcc (GCC) 4.0.2 20050901 (prerelease) (SUSE Linux) Copyright (C) 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ g++ StopWatch.cpp /usr/include/c++/4.0.2/bits/stl_tree.h: In member function âvoid std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::destroy_node(std::_Rb_tree_node<_Val>*) [with _Key = const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>*, _Val = std::pair<const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>* const, std::list<boost::intrusive_ptr<const boost::statechart::event_base>, std::allocator<boost::intrusive_ptr<const boost::statechart::event_base> > >
, _KeyOfValue = std::_Select1st<std::pair<const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>* const, std::list<boost::intrusive_ptr<const boost::statechart::event_base>, std::allocator<boost::intrusive_ptr<const boost::statechart::event_base> > >
, _Compare = std::less<const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>*>, _Alloc = std::allocator<const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>*>]â: /usr/include/c++/4.0.2/bits/stl_tree.h:1096: instantiated from âvoid std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_erase(std::_Rb_tree_node<_Val>*) [with _Key = const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>*, _Val = std::pair<const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>* const, std::list<boost::intrusive_ptr<const boost::statechart::event_base>, std::allocator<boost::intrusive_ptr<const boost::statechart::event_base> > > , _KeyOfValue = std::_Select1st<std::pair<const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>* const, std::list<boost::intrusive_ptr<const boost::statechart::event_base>, std::allocator<boost::intrusive_ptr<const boost::statechart::event_base> > > , _Compare = std::less<const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>*>, _Alloc = std::allocator<const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>*>]â /usr/include/c++/4.0.2/bits/stl_tree.h:570: instantiated from âstd::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::~_Rb_tree() [with _Key = const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>*, _Val = std::pair<const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>* const, std::list<boost::intrusive_ptr<const boost::statechart::event_base>, std::allocator<boost::intrusive_ptr<const boost::statechart::event_base> > > , _KeyOfValue = std::_Select1st<std::pair<const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>* const, std::list<boost::intrusive_ptr<const boost::statechart::event_base>, std::allocator<boost::intrusive_ptr<const boost::statechart::event_base> > > , _Compare = std::less<const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>*>, _Alloc = std::allocator<const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>*>]â /usr/include/c++/4.0.2/bits/stl_map.h:92: instantiated from âboost::statechart::state_machine<MostDerived, InitialState, Allocator, ExceptionTranslator>::state_machine() [with MostDerived = StopWatch, InitialState = Active, Allocator = std::allocator<void>, ExceptionTranslator = boost::statechart::null_exception_translator]â StopWatch.cpp:74: instantiated from here /usr/include/c++/4.0.2/bits/stl_tree.h:389: error: no matching function for call to âstd::allocator<const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>*>::destroy(std::pair<const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>* const, std::list<boost::intrusive_ptr<const boost::statechart::event_base>, std::allocator<boost::intrusive_ptr<const boost::statechart::event_base> > > *)â /usr/include/c++/4.0.2/ext/new_allocator.h:109: note: candidates are: void __gnu_cxx::new_allocator<_Tp>::destroy(_Tp*) [with _Tp = const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>*] /usr/include/c++/4.0.2/bits/stl_tree.h: In member function âstd::_Rb_tree_node<_Val>* std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_create_node(const _Val&) [with _Key = const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>*, _Val = std::pair<const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>* const, std::list<boost::intrusive_ptr<const boost::statechart::event_base>, std::allocator<boost::intrusive_ptr<const boost::statechart::event_base> > > , _KeyOfValue = std::_Select1st<std::pair<const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>* const, std::list<boost::intrusive_ptr<const boost::statechart::event_base>, std::allocator<boost::intrusive_ptr<const boost::statechart::event_base> > > , _Compare = std::less<const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>*>, _Alloc = std::allocator<const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>*>]â: /usr/include/c++/4.0.2/bits/stl_tree.h:793: instantiated from âtypename std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, const _Val&) [with _Key = const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>*, _Val = std::pair<const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>* const, std::list<boost::intrusive_ptr<const boost::statechart::event_base>, std::allocator<boost::intrusive_ptr<const boost::statechart::event_base> > > , _KeyOfValue = std::_Select1st<std::pair<const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>* const, std::list<boost::intrusive_ptr<const boost::statechart::event_base>, std::allocator<boost::intrusive_ptr<const boost::statechart::event_base> > > , _Compare = std::less<const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>*>, _Alloc = std::allocator<const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>*>]â /usr/include/c++/4.0.2/bits/stl_tree.h:902: instantiated from âtypename std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::insert_unique(std::_Rb_tree_iterator<_Val>, const _Val&) [with _Key = const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>*, _Val = std::pair<const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>* const, std::list<boost::intrusive_ptr<const boost::statechart::event_base>, std::allocator<boost::intrusive_ptr<const boost::statechart::event_base> > > , _KeyOfValue = std::_Select1st<std::pair<const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>* const, std::list<boost::intrusive_ptr<const boost::statechart::event_base>, std::allocator<boost::intrusive_ptr<const boost::statechart::event_base> > > , _Compare = std::less<const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>*>, _Alloc = std::allocator<const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>*>]â /usr/include/c++/4.0.2/bits/stl_map.h:384: instantiated from âtypename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, _Alloc>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::insert(typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, _Alloc>::iterator, const std::pair<const _Key, _Tp>&) [with _Key = const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>*, _Tp = std::list<boost::intrusive_ptr<const boost::statechart::event_base>, std::allocator<boost::intrusive_ptr<const boost::statechart::event_base> > , _Compare = std::less<const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>*>, _Alloc = std::allocator<const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>*>]â /usr/include/c++/4.0.2/bits/stl_map.h:339: instantiated from â_Tp& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const _Key&) [with _Key = const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>*, _Tp = std::list<boost::intrusive_ptr<const boost::statechart::event_base>, std::allocator<boost::intrusive_ptr<const boost::statechart::event_base> > , _Compare = std::less<const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>*>, _Alloc = std::allocator<const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>*>]â ../../../../boost/statechart/state_machine.hpp:576: instantiated from âvoid boost::statechart::state_machine<MostDerived, InitialState, Allocator, ExceptionTranslator>::defer_event(const boost::statechart::event_base&, const boost::statechart::detail::state_base<Allocator, boost::statechart::detail::rtti_policy>*) [with MostDerived = StopWatch, InitialState = Active, Allocator = std::allocator<void>, ExceptionTranslator = boost::statechart::null_exception_translator]â ../../../../boost/statechart/simple_state.hpp:495: instantiated from âboost::statechart::detail::reaction_result boost::statechart::simple_state<MostDerived, Context, InnerInitial, historyMode>::react_impl(const typename Context::inner_context_type::event_base_type&, typename Context::inner_context_type::rtti_policy_type::id_type) [with MostDerived = Stopped, Context = Active, InnerInitial = boost::mpl::list<mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::statechart::history_mode historyMode = has_no_history]â StopWatch.cpp:188: instantiated from here /usr/include/c++/4.0.2/bits/stl_tree.h:367: error: no matching function for call to âstd::allocator<const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>*>::construct(std::pair<const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>* const, std::list<boost::intrusive_ptr<const boost::statechart::event_base>, std::allocator<boost::intrusive_ptr<const boost::statechart::event_base> > > *, const std::pair<const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>* const, std::list<boost::intrusive_ptr<const boost::statechart::event_base>, std::allocator<boost::intrusive_ptr<const boost::statechart::event_base> > > &)â /usr/include/c++/4.0.2/ext/new_allocator.h:105: note: candidates are: void __gnu_cxx::new_allocator<_Tp>::construct(_Tp*, const _Tp&) [with _Tp = const boost::statechart::detail::state_base<std::allocator<void>, boost::statechart::detail::rtti_policy>*]
---- end of output ---- Does anyone have any clues to impart as to what's going on? -- Bardur Arantsson <bardur.arantsson@gmail.com> Bardur Arantsson <bardur@scientician.net> Bardur Arantsson <bardur@imada.sdu.dk>

Bardur Arantsson wrote:
Does anyone have any clues to impart as to what's going on?
I personally don't have a clue, but I can recommend that you obtain a copy of STLFilt that will help you decode the error message from - http://www.bdsoft.com/tools/stlfilt.html Regards Jim

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Jim Douglas wrote:
Bardur Arantsson wrote:
Does anyone have any clues to impart as to what's going on?
I personally don't have a clue, but I can recommend that you obtain a copy of STLFilt that will help you decode the error message from -
http://www.bdsoft.com/tools/stlfilt.html
Regards Jim
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Per their website, that compiler wrapper product doesn't yet work for gcc products younger than 3.3 Evan -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFD5lJ9pxCQXwV2bJARApK2AKC/ydNc6HuDe/x6GZE9nsbL3bh3bwCfYioU IDO8lphWdimQwoOSpbAZ1SM= =X31h -----END PGP SIGNATURE-----

Hi Bardur Bardur Arantsson wrote:
Hi all,
I'm trying to compile the StopWatch.cpp example on SuSE10 and I'm getting a whole bunch of errors (or at least what gcc thinks are errors): [error snipped]
Thanks for the report! This problem has been reported before (by private email). All I know for sure is that the same code works fine with GCC3.4.2 (and other compilers). The only thread you'll find by googling for "__gnu_cxx::new_allocator<_Tp>::destroy(_Tp*)" suggests that the GCC std allocator was changed in 4.0. Maybe Boost.Statechart makes use of a corner-case that is not covered in GCC4.0 allocator regression tests. Unfortunately I don't currently have the time to track this down. For now, I can only suggest to replace your copy of statechart.hpp with the one attached. It partially disables state_machine custom allocator support. Please let me know whether that works for you. HTH & Regards, -- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.

Andreas Huber wrote:
Hi Bardur
Bardur Arantsson wrote:
Hi all,
I'm trying to compile the StopWatch.cpp example on SuSE10 and I'm getting a whole bunch of errors (or at least what gcc thinks are errors): [error snipped]
Thanks for the report!
[--snip explanation--]
For now, I can only suggest to replace your copy of statechart.hpp with the one attached. It partially disables state_machine custom allocator support. Please let me know whether that works for you.
Seems to work OK. Thanks. -- Bardur Arantsson <bardurREMOVE@THISimada.sdu.dk> <bardurREMOVE@THISscientician.net> - NOBODY snuggles with Max Power! You strap yourself in and FEEL the G's. Max Power/Homer Simpson, 'The Simpsons'
participants (5)
-
Andreas Huber
-
Bardur Arantsson
-
Bardur Arantsson
-
Evan Carew
-
Jim Douglas