Boost logo

Boost :

From: Ben Pope (benpope81_at_[hidden])
Date: 2007-10-18 05:16:45


Hi,

I just started testing Boost 1.34.1 and have found this piece of code
produces a warning, which was not present in Boost 1.33.1:

---
#include <boost/bind.hpp>
struct Foo {};
struct Bar
{
   Foo GetFoo()
   {
      return Foo();
   }
};
int main()
{
   Bar bar;
   boost::bind(&Bar::GetFoo, bar);
}
---
1>boost\boost.1.34.1\boost\boost\bind.hpp(1575) : warning C4180:
qualifier applied to function type has no meaning; ignored
1>        boost\boost.1.34.1\boost\boost\bind.hpp(1609) : see
reference to class template instantiation 'boost::_bi::add_cref<Pm,I>'
being compiled
1>        with
1>        [
1>            Pm=Foo (__thiscall Bar::* )(void),
1>            I=1
1>        ]
1>        test1\test1.cpp(16) : see reference to class template
instantiation 'boost::_bi::dm_result<Pm,A1>' being compiled
1>        with
1>        [
1>            Pm=Foo (__thiscall Bar::* )(void),
1>            A1=Bar
1>        ]
It seems to pick this specialisation:
template< class M, class T > struct add_cref< M T::*, 1 >
{
    typedef M const & type; //bind.hpp(1575)
};
When I would have thought this one more appropriate:
template< class R, class T > struct add_cref< R (T::*) (), 1 >
{
    typedef void type; // bind.hpp(1580)
};
Any ideas?  Thanks,
Ben

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk