Modify

Opened 3 years ago

Last modified 3 years ago

#11304 new Bugs

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;

}


Attachments (0)

Change History (1)

comment:1 Changed 3 years ago by Peter Dimov

This was fixed recently by https://github.com/boostorg/bind/pull/11.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain Peter Dimov.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.