Opened 7 years ago

Closed 7 years ago

#11307 closed Bugs (duplicate)

bind added overload generate ambiguity

Reported by: gerald.langlois@… Owned by: Peter Dimov
Milestone: To Be Determined Component: bind
Version: Boost 1.58.0 Severity: Problem
Keywords: Cc:

Description

When providing an explicit return type when the function result_type may or may not be deduced. If the result type is the same than the one requested by the generated function, the two template specialization become valid and then create ambiguity.


template<class Rt2, class R, class T,

class B1, class A1, class A2> _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(mf1)<R, T, B1>, typename _bi::list_av_2<A1, A2>::type> BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1), A1 a1, A2 a2)

template<class R, class T,

class B1, class A1, class A2> _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(mf1)<R, T, B1>, typename _bi::list_av_2<A1, A2>::type> BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1), A1 a1, A2 a2)


Here is my use case that fail on my end

class any_function { public:

template <typename T0, typename T1, int i> typename boost::enable_if<

boost::is_member_function_pointer<T0>, CAnyFunction&>::type

set(T0 t0, T1 t1, boost::arg<i> i1) {

typedef function_traits<T0> traits; typedef typename traits::result_type result_type; Functor =

boost::function<result_type (traits::arg1_type)> (boost::bind<result_type>(t0, t1, i1));

return *this;

};

private:

boost::any Functor;

}


Change History (1)

comment:1 by Peter Dimov, 7 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #11304.

Note: See TracTickets for help on using tickets.