Why does this code fail to compile with VS 2005:
#include <boost/bind.hpp>
#include <boost/function.hpp>
struct X
{
typedef std::auto_ptr<int> IntType;
// typedef int IntType; // this works
IntType memfunc () const
{
return IntType ();
}
X ()
{
boost::bind (&X::memfunc, this);
}
};
with this warning & error:
1>j:\libraries\boost\boost_1_37_0\boost\bind.hpp(1643) : warning C4180: qualifier applied to function type has no meaning; ignored
1> j:\libraries\boost\boost_1_37_0\boost\bind.hpp(1677) : see reference to class template instantiation 'boost::_bi::add_cref<Pm,I>' being compiled
1> with
1> [
1> Pm=std::auto_ptr<int> (__thiscall X::* )(void),
1> I=1
1> ]
1> j:\dev\test\test\listtest.cpp(16) : see reference to class template instantiation 'boost::_bi::dm_result<Pm,A1>' being compiled
1> with
1> [
1> Pm=X::IntType (__thiscall X::* )(void),
1> A1=X *
1> ]
?
Changing the IntType typedef to just an int allows it to compile.