boost::bind, MSVC7.1 and volatile-qualification

Is there a known problem with boost::bind, volatile-qualified member functions and MSVC7.1? The following snippet of code happily compiles with various incantations of gcc, but fails with MSVC7.1. The same applies for 'const volatile'. #include <boost/function.hpp> #include <boost/bind.hpp> struct TEST { void gv0() volatile; void gvc0() volatile const; int gv2(int,int) volatile; int gvc2(int,int) volatile const; }; void instantiate() { TEST T; boost::function< void() > gv0 =boost::bind(&TEST::gv0,&T); // boost::function< int(int,int) > gv2 =boost::bind(&TEST::gv2,&T,_1,_2); // boost::function< void() > gcv0=boost::bind(&TEST::gvc0,&T); // boost::function< int(int,int) > gcv2=boost::bind(&TEST::gvc2,&T,_1,_2); } cl -c -TP -GS -GF -GR -vmv -vmg -EHsc -Zc:forScope -Zc:wchar_t -Op -Gm- -D_DEBUG -Od -Zi -Yd -MDd msvc71bind.cpp (Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86) ******\boost\mem_fn.hpp(256) : warning C4180: qualifier applied to function type has no meaning; ignored ******\boost\bind\bind_template.hpp(156) : see reference to class template instantiation 'boost::_mfi::dm<R,T>' being compiled with [ R=void (void) volatile, T=TEST ] msvc71bind.cpp(21) : see reference to class template instantiation 'boost::_bi::bind_t<R,F,L>' being compiled with [ R=void (__thiscall &)(void) volatile, F=boost::_mfi::dm<void (void) volatile,TEST>, L=boost::_bi::list_av_1<TEST *>::type ] ******\boost\mem_fn.hpp(264) : warning C4180: qualifier applied to function type has no meaning; ignored ******\boost\mem_fn.hpp(274) : warning C4180: qualifier applied to function type has no meaning; ignored ******\boost\mem_fn.hpp(288) : warning C4180: qualifier applied to function type has no meaning; ignored ******\boost\mem_fn.hpp(293) : warning C4180: qualifier applied to function type has no meaning; ignored ******\boost\mem_fn.hpp(307) : warning C4180: qualifier applied to function type has no meaning; ignored ******\boost\bind.hpp(1572) : warning C4180: qualifier applied to function type has no meaning; ignored msvc71bind.cpp(21) : see reference to function template instantiation 'boost::_bi::bind_t<R,F,L> boost::bind<void(void) volatile,TEST,TEST*>(void (__thiscall TEST::* ),A1)' being compiled with [ R=void (__thiscall &)(void) volatile, F=boost::_mfi::dm<void (void) volatile,TEST>, L=boost::_bi::list_av_1<TEST *>::type, A1=TEST * ] ******\boost\mem_fn.hpp(286) : error C4716: 'boost::_mfi::dm<void __thiscall TEST::(void)volatile ,TEST>::operator()' : must return a value

Schalk_Cronje@McAfee.com wrote:
Is there a known problem with boost::bind, volatile-qualified member functions and MSVC7.1?
Yes, boost::bind and boost::mem_fn do not support volatile-qualified member functions.
The following snippet of code happily compiles with various incantations of gcc, but fails with MSVC7.1.
I wonder why gcc is able to compile it. :-) Do you really have a volatile member function somewhere? I thought that they were "officially" worthless.
participants (2)
-
Peter Dimov
-
Schalk_Cronje@McAfee.com