
The following code compiles fine in MSVC 8.0 and gcc 3.4.4 but MSVC 7.1 renders the errors found below. struct X { template<class T> void bar() {} }; void foo() { X x; boost::bind(&X::bar<int>, x); } I'm using boost 1.34.0. Is this a known problem of MSVC 7x? Best Regards, Johan Torp === Part of error output === test.cpp(9) : error C2784: 'boost::_bi::bind_t<_bi::dm_result<MT::* ,A1>::type,boost::_mfi::dm<M,T>,_bi::list_av_1<A1>::type> boost::bind(M T::* ,A1)' : could not deduce template argument for 'overloaded function type' from 'overloaded function type' C:\Program Files\boost\boost_1_34_0\boost\bind.hpp(1628) : see declaration of 'boost::bind' test.cpp(9) : error C2780: 'boost::_bi::bind_t<R,boost::_mfi::cmf8<R,T,B1,B2,B3,B4,B5,B6,B7,B8>,_bi::list_av_9<A1,A2,A3,A4,A5,A6,A7,A8,A9>::type> boost::bind(R (__thiscall T::* )(B1,B2,B3,B4,B5,B6,B7,B8) const,A1,A2,A3,A4,A5,A6,A7,A8,A9)' : expects 10 arguments - 2 provided C:\Program Files\boost\boost_1_34_0\boost\bind\bind_mf_cc.hpp(222) : see declaration of 'boost::bind' test.cpp(9) : error C2780: 'boost::_bi::bind_t<R,boost::_mfi::mf8<R,T,B1,B2,B3,B4,B5,B6,B7,B8>,_bi::list_av_9<A1,A2,A3,A4,A5,A6,A7,A8,A9>::type> boost::bind(R (__thiscall T::* )(B1,B2,B3,B4,B5,B6,B7,B8),A1,A2,A3,A4,A5,A6,A7,A8,A9)' : expects 10 arguments - 2 provided <SUPERSNIP - LOADS OF LINES!> C:\Program Files\boost\boost_1_34_0\boost\bind.hpp(1233) : see declaration of 'boost::bind' test.cpp(9) : error C2780: 'boost::_bi::bind_t<R,F,_bi::list_av_2<A1,A2>::type> boost::bind(F,A1,A2)' : expects 3 arguments - 2 provided C:\Program Files\boost\boost_1_34_0\boost\bind.hpp(1225) : see declaration of 'boost::bind' test.cpp(9) : error C2784: 'boost::_bi::bind_t<R,F,_bi::list_av_1<A1>::type> boost::bind(F,A1)' : could not deduce template argument for 'overloaded function type' from 'overloaded function type' C:\Program Files\boost\boost_1_34_0\boost\bind.hpp(1217) : see declaration of 'boost::bind' test.cpp(9) : error C2780: 'boost::_bi::bind_t<R,F,boost::_bi::list0> boost::bind(F)' : expects 1 arguments - 2 provided C:\Program Files\boost\boost_1_34_0\boost\bind.hpp(1209) : see declaration of 'boost::bind' -- View this message in context: http://www.nabble.com/-bind--MSVC-7.1-problem-tf4600273.html#a13134123 Sent from the Boost - Dev mailing list archive at Nabble.com.

Johan Torp:
The following code compiles fine in MSVC 8.0 and gcc 3.4.4 but MSVC 7.1 renders the errors found below.
struct X { template<class T> void bar() {} };
void foo() { X x; boost::bind(&X::bar<int>, x); }
I'm using boost 1.34.0. Is this a known problem of MSVC 7x?
Function templates have been known to confuse earlier versions of MSVC. I don't think that this specific problem has been known, but now it is. :-) The usual workaround is to help the compiler by using void (X::*pmf) () = &X::bar<int>;
participants (2)
-
Johan Torp
-
Peter Dimov