Boost logo

Boost Users :

From: Michael Marcin (mmarcin_at_[hidden])
Date: 2007-06-19 15:12:29


I have a windows compiler that is a derivative of cw 9.4 that is complaining
when trying to compile the following

#include <boost/bind.hpp>

struct a
{
    void foo(int) {}
    void foo() {}
};

void bar()
{
    boost::bind( &a::foo, _1 );
}

the actual error is:

### mwccsym2.exe Compiler:
# In: C:\Subversion\boost-RC_1_34_0\boost\boost\bind.hpp
# From: bind_test.cpp
# ----------------------
# 1633: ::bind_t< result_type, F, list_type >( F( f ), list_type( a1 ) );
# Error: ^
# illegal implicit conversion from 'boost::_bi::bind_t<const void (&)(void
*const , const void *const , void *const , const void *const , int),
boost::_mfi::dm<void (const void *const , int), a>,
boost::_bi::list1<boost::arg<1>>>' to
# 'boost::_bi::bind_t<const void (&)(const void *const , int),
boost::_mfi::dm<void (const void *const , int), a>,
boost::_bi::list1<boost::arg<1>>>'
# (point of instantiation: 'bar()')
# (instantiating: 'boost::bind<boost::arg<1>, void (const void *const ,
int), a>(void (a::*)(int), boost::arg<1>)')

Changing the definition to

struct a
{
    void foo() {}
    void foo(int) {}
};

lets it compile but this is not a general solution as this fails to compile:

void bar()
{
    boost::bind( &a::foo, _1, 0 );
}

I've uploaded a full minimal example to my website including the compiler in
question if it helps.
http://www.mikemarcin.com/misc/mwccsym/bind_overload.zip

Thanks,

Michael Marcin


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net