1.34.1: boost bind issue with function template

Hi, I'm having problem compiling this piece of code in VC++ 7.1. I don't know if it is a bug in this environment but it compiles properly under gcc 3.4.4. thanks for any help !!! #include <boost/signal.hpp> #include <boost/bind.hpp> boost::signal<void (int)> m_signal; struct Foo { void test(int x) {} }; template <typename C> boost::signals::connection Subscribe(C* ptr,void (C::*callback)(int)) { return m_signal.connect(boost::bind(callback,ptr,_1)); } int main() { Foo f; Subscribe(&f, &Foo::test); return 0; } Here are the compiler errors: c:\Program Files\boost\boost_1_34_1\boost\visit_each.hpp(25) : warning C4675: 'void boost::_bi::visit_each<Visitor,void,boost::_mfi::mf1<R,T,A1>,boost::_bi::list2<boost::_bi::list_av_2<C *,A2>::B1,A2>>(V &,const boost::_bi::bind_t<R,F,L> &,int)' : resolved overload was found by argument-dependent lookup with [ Visitor=boost::signals::detail::bound_objects_visitor, R=void, T=Foo, A1=int, C=Foo, A2=boost::arg<1>, V=boost::signals::detail::bound_objects_visitor, F=boost::_mfi::mf1<void,Foo,int>, L=boost::_bi::list2<boost::_bi::list_av_2<Foo *,boost::arg<1>>::B1,boost::_bi::list_av_2<Foo *,boost::arg<1>>::B2> ] c:\Program Files\boost\boost_1_34_1\boost\bind.hpp(1173) : see declaration of 'boost::_bi::visit_each' c:\Program Files\boost\boost_1_34_1\boost\signals\slot.hpp(123) : see reference to function template instantiation 'void boost::visit_each<boost::signals::detail::bound_objects_visitor,F>(Visitor &,const T &)' being compiled with [ F=boost::_bi::bind_t<void,boost::_mfi::mf1<void,Foo,int>,boost::_bi::list2<boost::_bi::list_av_2<Foo *,boost::arg<1>>::B1,boost::_bi::list_av_2<Foo *,boost::arg<1>>::B2>>, Visitor=boost::signals::detail::bound_objects_visitor, T=boost::_bi::bind_t<void,boost::_mfi::mf1<void,Foo,int>,boost::_bi::list2<boost::_bi::list_av_2<Foo *,boost::arg<1>>::B1,boost::_bi::list_av_2<Foo *,boost::arg<1>>::B2>> ] c:\Documents and Settings\mbrodeur\My Documents\Visual Studio Projects\testboost\testboost\testboost.cpp(16) : see reference to function template instantiation 'boost::slot<SlotFunction>::slot<boost::_bi::bind_t<R,F,L>>(const boost::_bi::bind_t<R,F,L> &)' being compiled with [ SlotFunction=boost::signal1<boost::detail::function_traits_helper<boost::add_pointer<void (int)>::type>::result_type,boost::detail::function_traits_helper<boost::add_pointer<void (int)>::type>::arg1_type,boost::last_value<void>,int,std::less<int>,boost::function<void (int)>>::slot_function_type, R=void, F=boost::_mfi::mf1<void,Foo,int>, L=boost::_bi::list2<boost::_bi::list_av_2<Foo *,boost::arg<1>>::B1,boost::_bi::list_av_2<Foo *,boost::arg<1>>::B2> ] c:\Documents and Settings\mbrodeur\My Documents\Visual Studio Projects\testboost\testboost\testboost.cpp(22) : see reference to function template instantiation 'boost::signals::connection Subscribe<Foo>(C *,void (__thiscall Foo::* )(int))' being compiled with [ C=Foo ] thanks ! -- View this message in context: http://www.nabble.com/1.34.1%3A-boost-bind-issue-with-function-template-tp19... Sent from the Boost - Users mailing list archive at Nabble.com.

#include <boost/signal.hpp> #include <boost/bind.hpp> boost::signal<void (int)> m_signal; struct Foo { void test(int x) {} }; template <typename C> boost::signals::connection Subscribe(C* ptr,void (C::*callback)(int)) { return m_signal.connect(boost::bind(callback,ptr,_1)); } int main() { Foo f; Subscribe(&f, &Foo::test); return 0; } Builds fine under VC8; can you upgrade to 2005? ****************************************************************************** "This message and any attachments are solely for the intended recipient and may contain confidential and privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you." Interactive Transaction Solutions Ltd (2473364 England) Registered Office: Systems House, Station Approach Emsworth PO10 7PW ********************************************************************** Ce message �lectronique contient des informations confidentielles � l'usage unique des destinataires indiqu�s, personnes physiques ou morales. Si vous n'�tes pas le destinataire voulu, toute divulgation, copie, ou diffusion ou toute autre utilisation de ces informations, est interdite. Si vous avez re�u ce message �lectronique par erreur, nous vous remercions d'en avertir son exp�diteur imm�diatement par email et de d�truire ce message ainsi que les �l�ments attach�s. Interactive transaction Solutions SAS- France (RCS Pontoise : 489 397 877) Si�ge social : Parc Saint Christophe, 10, Avenue de l�Entreprise 95865 Cergy-Pontoise Cedex ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________

Unfortunately, I cannot, ... I must generate my binaries under vc++ 7.1. thanks Patrick Loney wrote:
#include <boost/signal.hpp> #include <boost/bind.hpp>
boost::signal<void (int)> m_signal;
struct Foo { void test(int x) {} };
template <typename C> boost::signals::connection Subscribe(C* ptr,void (C::*callback)(int)) { return m_signal.connect(boost::bind(callback,ptr,_1)); }
int main() { Foo f; Subscribe(&f, &Foo::test); return 0; }
Builds fine under VC8; can you upgrade to 2005?
******************************************************************************
"This message and any attachments are solely for the intended recipient and may contain confidential and privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you."
Interactive Transaction Solutions Ltd (2473364 England)
Registered Office: Systems House, Station Approach Emsworth PO10 7PW
**********************************************************************
Ce message électronique contient des informations confidentielles à l'usage unique des destinataires indiqués, personnes physiques ou morales. Si vous n'êtes pas le destinataire voulu, toute divulgation, copie, ou diffusion ou toute autre utilisation de ces informations, est interdite. Si vous avez reçu ce message électronique par erreur, nous vous remercions d'en avertir son expéditeur immédiatement par email et de détruire ce message ainsi que les éléments attachés.
Interactive transaction Solutions SAS- France (RCS Pontoise : 489 397 877)
Siège social : Parc Saint Christophe, 10, Avenue de lEntreprise 95865 Cergy-Pontoise Cedex
______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- View this message in context: http://www.nabble.com/1.34.1%3A-boost-bind-issue-with-function-template-tp19... Sent from the Boost - Users mailing list archive at Nabble.com.

mbrodeur65:
Hi,
I'm having problem compiling this piece of code in VC++ 7.1. I don't know if it is a bug in this environment but it compiles properly under gcc 3.4.4.
thanks for any help !!!
...
Here are the compiler errors:
c:\Program Files\boost\boost_1_34_1\boost\visit_each.hpp(25) : warning C4675: 'void boost::_bi::visit_each<Visitor,void,boost::_mfi::mf1<R,T,A1>,boost::_bi::list2<boost::_bi::list_av_2<C *,A2>::B1,A2>>(V &,const boost::_bi::bind_t<R,F,L> &,int)' : resolved overload was found by argument-dependent lookup
I see no errors here, just a harmless warning. Am I missing something?

Yes, you are right, there are only warnings. However, I'm a bit scared of possible side effects. I usually prefer to eliminate them by adopting the proper syntax, which obviously, I don't have. thanks. Martin Peter Dimov-5 wrote:
mbrodeur65:
Hi,
I'm having problem compiling this piece of code in VC++ 7.1. I don't know if it is a bug in this environment but it compiles properly under gcc 3.4.4.
thanks for any help !!!
...
Here are the compiler errors:
c:\Program Files\boost\boost_1_34_1\boost\visit_each.hpp(25) : warning C4675: 'void boost::_bi::visit_each<Visitor,void,boost::_mfi::mf1<R,T,A1>,boost::_bi::list2<boost::_bi::list_av_2<C *,A2>::B1,A2>>(V &,const boost::_bi::bind_t<R,F,L> &,int)' : resolved overload was found by argument-dependent lookup
I see no errors here, just a harmless warning. Am I missing something?
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- View this message in context: http://www.nabble.com/1.34.1%3A-boost-bind-issue-with-function-template-tp19... Sent from the Boost - Users mailing list archive at Nabble.com.

--- On Fri, 29/8/08, mbrodeur65 <martin.brodeur@adacelcanada.com> wrote:
From: mbrodeur65 <martin.brodeur@adacelcanada.com> Subject: Re: [Boost-users] 1.34.1: boost bind issue with function template To: boost-users@lists.boost.org Date: Friday, 29 August, 2008, 8:01 PM Yes, you are right, there are only warnings. However, I'm a bit scared of possible side effects. I usually prefer to eliminate them by adopting the proper syntax, which obviously, I don't have.
thanks. Martin
Peter Dimov-5 wrote:
mbrodeur65:
Hi,
I'm having problem compiling this piece of
if it is a bug in this environment but it compiles
code in VC++ 7.1. I don't know properly under gcc 3.4.4.
thanks for any help !!!
...
Here are the compiler errors:
c:\Program Files\boost\boost_1_34_1\boost\visit_each.hpp(25) : warning C4675: 'void
boost::_bi::visit_each<Visitor,void,boost::_mfi::mf1<R,T,A1>,boost::_bi::list2<boost::_bi::list_av_2<C
*,A2>::B1,A2>>(V &,const boost::_bi::bind_t<R,F,L> &,int)' : resolved overload was found by argument-dependent lookup
I see no errors here, just a harmless warning. Am I missing something?
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- View this message in context: http://www.nabble.com/1.34.1%3A-boost-bind-issue-with-function-template-tp19... Sent from the Boost - Users mailing list archive at Nabble.com.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
I use the same compiler and disabled the warning in the project properties. There's some more info here about it http://msdn.microsoft.com/en-us/library/aa984668(VS.71).aspx I see the warning as more of a history lesson telling you that the previous Microsoft C++ compilers didn't implement Koenig lookup.

on Fri Aug 29 2008, mbrodeur65 <martin.brodeur-AT-adacelcanada.com> wrote:
Yes, you are right, there are only warnings. However, I'm a bit scared of possible side effects. I usually prefer to eliminate them by adopting the proper syntax, which obviously, I don't have.
There's no syntax to turn that warning off other than some MSVC-specific pragma. What the warning is telling you is, "previous versions of MSVC were non-conforming in that they didn't support argument-dependent lookup. This version supports it, so overload resolution may have found a different overload with this version than it would have with a previous one." In other words, everything is working as it should now.
c:\Program Files\boost\boost_1_34_1\boost\visit_each.hpp(25) : warning C4675: 'void boost::_bi::visit_each<Visitor,void,boost::_mfi::mf1<R,T,A1>,boost::_bi::list2<boost::_bi::list_av_2<C *,A2>::B1,A2>>(V &,const boost::_bi::bind_t<R,F,L> &,int)' : resolved overload was found by argument-dependent lookup
I see no errors here, just a harmless warning. Am I missing something?
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Dave Abrahams BoostPro Computing http://www.boostpro.com
participants (5)
-
David Abrahams
-
mbrodeur65
-
Patrick Loney
-
Peter Barker
-
Peter Dimov