Opened 7 years ago

Closed 7 years ago

#11306 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;

}


Attachments (1)

bind.patch (11.9 KB ) - added by gerald.langlois@… 7 years ago.
I used boost::disable to remove ambiguity and had to include files in another header since the one in which I had to do the fix is not included from the global namespace

Download all attachments as: .zip

Change History (4)

by gerald.langlois@…, 7 years ago

Attachment: bind.patch added

I used boost::disable to remove ambiguity and had to include files in another header since the one in which I had to do the fix is not included from the global namespace

comment:1 by Alex Merry <alexander.merry@…>, 7 years ago

You may get a better response submitting a pull request at https://github.com/boostorg/bind

comment:2 by Peter Dimov, 7 years ago

This has already been fixed in Git.

comment:3 by Peter Dimov, 7 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #11304.

Note: See TracTickets for help on using tickets.