Boost logo

Boost :

From: Markus Schöpflin (markus.schoepflin_at_[hidden])
Date: 2008-05-21 07:49:27


Peter Dimov wrote:
> Markus Schöpflin:
>> Hello,
>>
>> a number of platforms currently fail to compile these tests with an error
>> message similar to the following:
>>
>> cxx: Error: ../boost/thread/pthread/thread.hpp, line 169: more than one
>> instance of overloaded function "boost::bind" matches the
>> argument
>> list: (ambovlfun)
>> function template "boost::bind<R,F,A1>(F, A1)"
>> function template "boost::bind(R (T::*)(), A1)"
>>
>>
>> The code in question reads:
>>
>> template <class F,class A1>
>> thread(F f,A1 a1):
>> thread_info(make_thread_info(boost::bind<void>(f,a1)))
>> {
>> start_thread();
>> }
>
> The best fix here is probably
>
> boost::bind( boost::type<void>(), f, a1 )

This fails (CXX 7.1 on Tru64) with:

cxx: Error: ../../../boost/mem_fn.hpp, line 342: a pointer to a bound
           function may only be used to call the function (boundfuncalled)
           detected during:
             instantiation of "R &boost::_mfi::dm<R, T>::operator()(T *) const

followed by a few 100 lines of error context.

>
>> 1) make_thread_info(boost::bind(f,a1))
>
> This will fail when f is a function object without a result_type typedef.
>
>> 2) make_thread_info(boost::bind<void>(mem_fn(f),a1))
>
> This will fail when f is not a member pointer.
>
> It seems that these will be exposed by test_thread_launching. It only misses
> the cases "ordinary function with arguments" and "member pointer".
>
> The alternative syntax should work in all cases; can you please test it?

See above for results. Do you consider it to be a compiler problem?

Hmm, maybe modifying the tests to use

   boost::thread t(mem_fn(&this_type::locking_thread),this)

would be the easiest way out?

Markus


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk