[Boost-users] [bind?] 'boost::bind' : ambiguous call to overloaded function -- when compiling for x64

343 views
Skip to first unread message

Igor R

unread,
Mar 8, 2012, 4:12:52 PM3/8/12
to boost...@lists.boost.org
Hello,

My project builds well with MSVC10 for x86 platform. However, when I
tried to build it for x64, I started to get the following strange
error:

1>...cpp(42): error C2668: 'boost::bind' : ambiguous call to overloaded function
1> ...\boost\boost/bind/bind_mf_cc.hpp(43): could be
'boost::_bi::bind_t<R,F,L> boost::bind<void,MyImpl,const
boost::system::error_code&,boost::shared_ptr<T>,boost::system::error_code>(R
(__cdecl MyImpl::* )(B1),A1,A2)'
<...>
1> ...\boost\boost/bind/bind_mf_cc.hpp(43): or
'boost::_bi::bind_t<R,F,L> boost::bind<void MyImpl,const
boost::system::error_code&,boost::shared_ptr<T>,boost::system::error_code>(R
(__cdecl MyImpl::* )(B1),A1,A2)'

Note that the both variants are actually the same one.

The source line that causes the error looks like this:
io_service_.post(boost::bind(&MyImpl::func, someSharedPtr));
i.e. boost::bind name is fully qualified.

Unfortunately, I can't reproduce this error in a "fresh" trivial
project, so I realize that the problem most likely isn't in Bind, but
somewhere in my project. The question is what could cause such a
behavior? Did anyone encounter such an issue?

Thanks.
_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Igor R

unread,
Mar 8, 2012, 4:25:59 PM3/8/12
to boost...@lists.boost.org
> My project builds well with MSVC10 for x86 platform. However, when I
> tried to build it for x64, I started to get the following strange
> error:
>
> 1>...cpp(42): error C2668: 'boost::bind' : ambiguous call to overloaded function
> 1>          ...\boost\boost/bind/bind_mf_cc.hpp(43): could be
> 'boost::_bi::bind_t<R,F,L> boost::bind<void,MyImpl,const
> boost::system::error_code&,boost::shared_ptr<T>,boost::system::error_code>(R
> (__cdecl MyImpl::* )(B1),A1,A2)'
> <...>
> 1>          ...\boost\boost/bind/bind_mf_cc.hpp(43): or
> 'boost::_bi::bind_t<R,F,L> boost::bind<void MyImpl,const
> boost::system::error_code&,boost::shared_ptr<T>,boost::system::error_code>(R
> (__cdecl MyImpl::* )(B1),A1,A2)'
>
> Note that the both variants are actually the same one.


Well, as usually, the problem was solved two minutes after the
question had been sent.
The problem was that my precompiled header contained the following definition:

#ifdef _WIN32
#define BOOST_MEM_FN_ENABLE_STDCALL
#endif

and it appears that _WIN32 is defined both for x86 and for x64 platforms...

Reply all
Reply to author
Forward
0 new messages