I've just encountered this problem and it looks like a MS bug. Not sure it
deserves a Boost workaround but I thought it would be nice to let you know
(in case you don't already).
Here's the code:
#include
namespace A{
struct c{
void setName(const char*) {}
};
}
namespace B{
struct c{
void setName(const char*) {}
};
}
using namespace B;
using namespace A;
int main() {
boost::bind(&A::c::setName, _1, _2);
return 0;
}
It looks legal to me but I'm no expert. GCC compiles with no warnings but
MSVC++ 6sp5 gives the error below.
boost/bind/mem_fn_vw.hpp(29) : error C2872: 'c' : ambiguous symbol
boost/bind.hpp(875) : see reference to class template
instantiation 'boost::_mfi::mf1' being compiled
boost/bind.hpp(886) : see reference to class template
instantiation 'boost::_bi::bind_t_generator<void>::implementation,class
boost::_bi::list2,class boost::arg<2> > >' being
compiled
test.cpp(15) : see reference to class template instantiation
'boost::_bi::bind_t,class boost::_bi::list2,cla
ss boost::arg<2> > >' being compiled
boost/bind/mem_fn_vw.hpp(31) : error C2872: 'c' : ambiguous symbol
boost/bind.hpp(875) : see reference to class template
instantiation 'boost::_mfi::mf1' being
compiled
boost/bind.hpp(886) : see reference to class template
instantiation 'boost::_bi::bind_t_generator<void>::implementation,class
boost::_bi::list2,class boost::arg<2> > >' being
compiled
test.cpp(15) : see reference to class template instantiation
'boost::_bi::bind_t,class boost::_bi::list2,class boost::arg<2> >
' being compiled
Best,
Andre Hentz