Boost logo

Boost Users :

Subject: [Boost-users] boost::unordered_map and exceptions disabled
From: Marcello Maggioni (hayarms_at_[hidden])
Date: 2012-07-22 11:23:22


Hello,

I'm a user of boost::unordered_map and I always used this container with
exceptions disabled (because I never use them and don't want them enabled
if possible). I never had problems with that, but now with boost 1.50 and
GCC 4.7.1 I get this error while compiling code using unordered_map:

In file included from /usr/include/boost/unordered/unordered_map.hpp:17:0,
                 from /usr/include/boost/unordered_map.hpp:16,
                 from /home/hades/Bitral/include/CodeRegion.h:23,
                 from /home/hades/Bitral/src/BitralContext.cpp:20:
/usr/include/boost/unordered/detail/allocator_helpers.hpp: In instantiation
of 'void boost::unordered::detail::construct_node(Alloc&, T*, const Args&)
[with Alloc =
std::allocator<boost::unordered::detail::ptr_node<std::pair<const
Bitral::ConstantMemoryAddress, Bitral::CodeRegion*> > >; T =
boost::unordered::detail::ptr_node<std::pair<const
Bitral::ConstantMemoryAddress, Bitral::CodeRegion*> >; Args =
boost::unordered::detail::emplace_args3<boost::unordered::piecewise_construct_t,
boost::tuples::tuple<Bitral::ConstantMemoryAddress,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type>, boost::tuples::tuple<> >]':
/usr/include/boost/unordered/detail/buckets.hpp:75:13: required from
'void
boost::unordered::detail::node_constructor<NodeAlloc>::construct_value(const
Args&) [with Args =
boost::unordered::detail::emplace_args3<boost::unordered::piecewise_construct_t,
boost::tuples::tuple<Bitral::ConstantMemoryAddress,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type>, boost::tuples::tuple<> >; NodeAlloc =
std::allocator<boost::unordered::detail::ptr_node<std::pair<const
Bitral::ConstantMemoryAddress, Bitral::CodeRegion*> > >]'
/usr/include/boost/unordered/detail/unique.hpp:386:13: required from
'boost::unordered::detail::table_impl<Types>::value_type&
boost::unordered::detail::table_impl<Types>::operator[](const key_type&)
[with Types = boost::unordered::detail::map<std::allocator<std::pair<const
Bitral::ConstantMemoryAddress, Bitral::CodeRegion*> >,
Bitral::ConstantMemoryAddress, Bitral::CodeRegion*,
boost::hash<Bitral::ConstantMemoryAddress>,
std::equal_to<Bitral::ConstantMemoryAddress> >;
boost::unordered::detail::table_impl<Types>::value_type = std::pair<const
Bitral::ConstantMemoryAddress, Bitral::CodeRegion*>;
boost::unordered::detail::table_impl<Types>::key_type =
Bitral::ConstantMemoryAddress]'
/usr/include/boost/unordered/unordered_map.hpp:1196:26: required from
'boost::unordered::unordered_map<K, T, H, P, A>::mapped_type&
boost::unordered::unordered_map<K, T, H, P, A>::operator[](const key_type&)
[with K = Bitral::ConstantMemoryAddress; T = Bitral::CodeRegion*; H =
boost::hash<Bitral::ConstantMemoryAddress>; P =
std::equal_to<Bitral::ConstantMemoryAddress>; A =
std::allocator<std::pair<const Bitral::ConstantMemoryAddress,
Bitral::CodeRegion*> >; boost::unordered::unordered_map<K, T, H, P,
A>::mapped_type = Bitral::CodeRegion*; boost::unordered::unordered_map<K,
T, H, P, A>::key_type = Bitral::ConstantMemoryAddress]'
/home/hades/Bitral/src/BitralContext.cpp:30:31: required from here
/usr/include/boost/unordered/detail/allocator_helpers.hpp:643:11: error:
exception handling disabled, use -fexceptions to enable

The strange thing is that compiling the code with CLANG 3.1 and exceptions
explicitly disabled works fine.

There is a way to make it work with exceptions disabled and G++?

Thanks

Marcello



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net