Opened 7 years ago

Closed 7 years ago

#11308 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 (5)

bind.patch (11.9 KB ) - added by gerald.langlois@… 7 years ago.
Using boost::disable to remove ambiguity
bind.2.patch (11.9 KB ) - added by gerald.langlois@… 7 years ago.
Using boost::disable to remove ambiguity
bind.3.patch (11.9 KB ) - added by gerald.langlois@… 7 years ago.
Using boost::disable to remove ambiguity
bind.4.patch (11.9 KB ) - added by gerald.langlois@… 7 years ago.
Using boost::disable to remove ambiguity
bind.5.patch (11.9 KB ) - added by gerald.langlois@… 7 years ago.
Using boost::disable to remove ambiguity

Download all attachments as: .zip

Change History (6)

by gerald.langlois@…, 7 years ago

Attachment: bind.patch added

Using boost::disable to remove ambiguity

by gerald.langlois@…, 7 years ago

Attachment: bind.2.patch added

Using boost::disable to remove ambiguity

by gerald.langlois@…, 7 years ago

Attachment: bind.3.patch added

Using boost::disable to remove ambiguity

by gerald.langlois@…, 7 years ago

Attachment: bind.4.patch added

Using boost::disable to remove ambiguity

by gerald.langlois@…, 7 years ago

Attachment: bind.5.patch added

Using boost::disable to remove ambiguity

comment:1 by Peter Dimov, 7 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #11304.

Note: See TracTickets for help on using tickets.