
On 10/5/2010 9:13 AM, Sascha Ochsenknecht wrote:
Hello,
I got an error from the Sun Studio 12.2 (CC 5.11) when trying to compile my sources. The error comes out of the Boost.Proto library (actually I'm doing something with Boost.Spirit and Boost.Spirit is using Boost.Proto ..., but I don't think that the problem is in the client code, it seems to come from the buggy compiler). I'm using Boost 1.43.
This is what I got from the compiler:
"...include/boost/proto/detail/decltype.hpp", line 343: Error: Partial specialization parameter V is not used in the arguments.
Can you try replacing the definition of result_of_ in decltype.hpp with the following: template<typename T> struct sun_workaround_helper { typedef T type; }; template<typename T, typename Void = void> struct result_of_2 : boost::tr1_result_of<typename T::type> {}; template<typename T, typename U, typename V> struct result_of_2< sun_workaround_helper<T U::*(V)> , typename enable_if_c<is_member_object_pointer<T U::*>::value>::type > { BOOST_STATIC_CONSTANT(bool, is_V_a_smart_ptr = 2 == sizeof(test_V_is_a_U<U>(&lvalue(make<V>())))); BOOST_STATIC_CONSTANT(bool, is_ptr_to_const = 2 == sizeof(test_ptr_to_const(BOOST_PROTO_GET_POINTER(U, make<V>())))); // If V is not a U, then it is a (smart) pointer and we can always return an lvalue. // Otherwise, we can only return an lvalue if we are given one. typedef typename mpl::eval_if_c< (is_V_a_smart_ptr || is_reference<V>::value) , mpl::eval_if_c< is_ptr_to_const , add_reference<typename add_const<T>::type> , add_reference<T> > , mpl::identity<T> >::type type; }; //////////////////////////////////////////////////////////////////////////////////////////// // result_of_ is a wrapper around boost::result_of that also handles "invocations" of // member object pointers. template<typename T> struct result_of_ : result_of_2<sun_workaround_helper<T> > {}; Let me know how that works. Thanks, -- Eric Niebler BoostPro Computing http://www.boostpro.com