functional/hash and mp_math weirdness

Hello, I'm experiencing troubles with functional/hash #include <boost/functional/hash.hpp> #include <boost/mp_math/integer.hpp> typedef boost::mp_math::integer<> big_integer; class A { friend A operator*( const big_integer& lhs, const A& rhs ) {} }; gives the following madness. What surprises me is that I am not making any use of functional/hash (in the actual code, it gets included from boost/unordered_map.hpp), as the error messages don't indicate any line of my code. I think mp_math is not playing a big role here, once I had the same problem with a homemade class (but unfortunately I can't now replicate the same conditions). Can anyone explain me what is going on here ? Thanks you all in advice, Andrea /home/andrea/boost_1_39_0/boost/integer/static_log2.hpp: In instantiation of 'boost::detail::static_log2_impl::static_log2_impl<2ul, 16>': /home/andrea/boost_1_39_0/boost/integer/static_log2.hpp:117: instantiated from 'boost::static_log2<2ul>' /home/andrea/boost_1_39_0/boost/functional/hash/detail/hash_float.hpp:150: instantiated from 'size_t boost::hash_detail::float_hash_impl(T) [with T = float]' /home/andrea/boost_1_39_0/boost/functional/hash/detail/hash_float.hpp:187: instantiated from 'size_t boost::hash_detail::float_hash_value(T) [with T = float]' /home/andrea/boost_1_39_0/boost/functional/hash/hash.hpp:304: instantiated from here /home/andrea/boost_1_39_0/boost/integer/static_log2.hpp:89: error: 'boost::detail::static_log2_impl::static_log2_impl<2ul, 16>::<anonymous enum>' is/uses anonymous type /home/andrea/boost_1_39_0/boost/integer/static_log2.hpp:89: error: trying to instantiate 'template<class Type> template<class T1> boost::mp_math::integer::integer(const T1&)' /home/andrea/boost_1_39_0/boost/integer/static_log2.hpp: In instantiation of 'boost::detail::static_log2_impl::static_log2_impl<2ul, 8>': /home/andrea/boost_1_39_0/boost/integer/static_log2.hpp:89: instantiated from 'boost::detail::static_log2_impl::static_log2_impl<2ul, 16>' /home/andrea/boost_1_39_0/boost/integer/static_log2.hpp:117: instantiated from 'boost::static_log2<2ul>' /home/andrea/boost_1_39_0/boost/functional/hash/detail/hash_float.hpp:150: instantiated from 'size_t boost::hash_detail::float_hash_impl(T) [with T = float]' /home/andrea/boost_1_39_0/boost/functional/hash/detail/hash_float.hpp:187: instantiated from 'size_t boost::hash_detail::float_hash_value(T) [with T = float]' /home/andrea/boost_1_39_0/boost/functional/hash/hash.hpp:304: instantiated from here /home/andrea/boost_1_39_0/boost/integer/static_log2.hpp:89: error: 'boost::detail::static_log2_impl::static_log2_impl<2ul, 8>::<anonymous enum>' is/uses anonymous type /home/andrea/boost_1_39_0/boost/integer/static_log2.hpp:89: error: trying to instantiate 'template<class Type> template<class T1> boost::mp_math::integer::integer(const T1&)' ... ...

Daniel James <daniel_james <at> fmail.co.uk> writes:
It appears to be a bug in g++ 4.0 when using member enums. Can you try that attached patch?
Great, thanks. It's indeed a g++ 4.0 bug, g++ 4.2 accepts the code without any complain. Yes, your patch solves the problem also for g++ 4.0. Thanks, Andrea
participants (2)
-
Andrea Bedini
-
Daniel James