
I have a windows compiler that is a derivative of cw 9.4 that is complaining when trying to compile the following #include <boost/bind.hpp> struct a { void foo(int) {} void foo() {} }; void bar() { boost::bind( &a::foo, _1 ); } the actual error is: ### mwccsym2.exe Compiler: # In: C:\Subversion\boost-RC_1_34_0\boost\boost\bind.hpp # From: bind_test.cpp # ---------------------- # 1633: ::bind_t< result_type, F, list_type >( F( f ), list_type( a1 ) ); # Error: ^ # illegal implicit conversion from 'boost::_bi::bind_t<const void (&)(void *const , const void *const , void *const , const void *const , int), boost::_mfi::dm<void (const void *const , int), a>, boost::_bi::list1<boost::arg<1>>>' to # 'boost::_bi::bind_t<const void (&)(const void *const , int), boost::_mfi::dm<void (const void *const , int), a>, boost::_bi::list1<boost::arg<1>>>' # (point of instantiation: 'bar()') # (instantiating: 'boost::bind<boost::arg<1>, void (const void *const , int), a>(void (a::*)(int), boost::arg<1>)') Changing the definition to struct a { void foo() {} void foo(int) {} }; lets it compile but this is not a general solution as this fails to compile: void bar() { boost::bind( &a::foo, _1, 0 ); } I've uploaded a full minimal example to my website including the compiler in question if it helps. http://www.mikemarcin.com/misc/mwccsym/bind_overload.zip Thanks, Michael Marcin

Michael Marcin wrote:
...
Sounds like a compiler bug. boost::bind tries to do its best to resolve ambiguous overloads, but this is not possible in general, even without compiler limitations getting in the way. You'd need to pick the right overload manually: void bar() { void (a::*pmf)( int ) = &a::foo; boost::bind( pmf, _1, 0 ); }
participants (2)
-
Michael Marcin
-
Peter Dimov