Boost logo

Boost :

From: Richard Crossley (rdc_at_[hidden])
Date: 2005-07-22 04:54:27


The following simple example fails to compile with VC71, (OK with Intel
8.1).

Is there a workaround for this?

Regards,

Richard.

----------------------

#include <boost/lambda/bind.hpp>

struct S{
    void mfn1(){};
    void mfn2() throw() {};
};

int main()
{
    using namespace boost::lambda;

    S s;
    bind(&S::mfn1,_1)(s); // OK
    bind(&S::mfn2,_1)(s); // Error with VC71
}

----------------------

cl /c /Od /Gm /EHsc /RTC1 /MLd /Zc:wchar_t /Zc:forScope /GR /ZI /W3 /D
"WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Fo"Debug/" /Fd"Debug/vc70.pdb"
/Gd /TP
   .\TestBind.cpp

TestBind.cpp
c:\boost\boost\lambda\detail\bind_functions.hpp(220) : error C2664:
'boost::lambda::lambda_functor<T>::lambda_functor(const
boost::lambda::lambda_functor<T> &)' : cannot convert parameter 1 from
'boost::lambda::lambda_functor_base<Act,Args>' to 'const
boost::lambda::lambda_functor<T> &'
        with
        [
 
T=boost::lambda::lambda_functor_base<boost::lambda::action<2,boost::lambda::
function_action<2>>,boost::tuples::tuple<const
boost::lambda::detail::bind_traits<void (__thiscall S::* const
)(void)>::type,const boost::lambda::detail::bind_traits<const
boost::lambda::placeholder1_type>::type,boost::lambda::detail::bind_traits<b
oost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tup
les::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null
_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::t
ype,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost
::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda:
:detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail::
bind_traits<boost::tuples::null_type>::type>>
        ]
        and
        [
            Act=boost::lambda::action<2,boost::lambda::function_action<2>>,
            Args=boost::tuples::tuple<const
boost::lambda::detail::bind_traits<void (__thiscall S::* const )(void)
throw()>::type,const boost::lambda::detail::bind_traits<const
boost::lambda::placeholder1_type>::type,boost::lambda::detail::bind_traits<b
oost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tup
les::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null
_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::t
ype,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost
::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda:
:detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail::
bind_traits<boost::tuples::null_type>::type>
        ]
        and
        [
 
T=boost::lambda::lambda_functor_base<boost::lambda::action<2,boost::lambda::
function_action<2>>,boost::tuples::tuple<const
boost::lambda::detail::bind_traits<void (__thiscall S::* const
)(void)>::type,const boost::lambda::detail::bind_traits<const
boost::lambda::placeholder1_type>::type,boost::lambda::detail::bind_traits<b
oost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tup
les::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null
_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::t
ype,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost
::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda:
:detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail::
bind_traits<boost::tuples::null_type>::type>>
        ]
        Reason: cannot convert from
'boost::lambda::lambda_functor_base<Act,Args>' to 'const
boost::lambda::lambda_functor<T>'
        with
        [
            Act=boost::lambda::action<2,boost::lambda::function_action<2>>,
            Args=boost::tuples::tuple<const
boost::lambda::detail::bind_traits<void (__thiscall S::* const )(void)
throw()>::type,const boost::lambda::detail::bind_traits<const
boost::lambda::placeholder1_type>::type,boost::lambda::detail::bind_traits<b
oost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tup
les::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null
_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::t
ype,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost
::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda:
:detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail::
bind_traits<boost::tuples::null_type>::type>
        ]
        and
        [
 
T=boost::lambda::lambda_functor_base<boost::lambda::action<2,boost::lambda::
function_action<2>>,boost::tuples::tuple<const
boost::lambda::detail::bind_traits<void (__thiscall S::* const
)(void)>::type,const boost::lambda::detail::bind_traits<const
boost::lambda::placeholder1_type>::type,boost::lambda::detail::bind_traits<b
oost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tup
les::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null
_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::t
ype,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost
::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda:
:detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail::
bind_traits<boost::tuples::null_type>::type>>
        ]
        No constructor could take the source type, or constructor overload
resolution was ambiguous
        c:\Source\TestBind\TestBind.cpp(13) : see reference to function
template instantiation 'const boost::lambda::lambda_functor<T>
boost::lambda::bind<void(__thiscall S::*
)(void),boost::lambda::placeholder1_type>(const Arg1 & ,const Arg2 &)' being
compiled
        with
        [
 
T=boost::lambda::lambda_functor_base<boost::lambda::action<2,boost::lambda::
function_action<2>>,boost::tuples::tuple<const
boost::lambda::detail::bind_traits<void (__thiscall S::* const
)(void)>::type,const boost::lambda::detail::bind_traits<const
boost::lambda::placeholder1_type>::type,boost::lambda::detail::bind_traits<b
oost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tup
les::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null
_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::t
ype,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost
::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda:
:detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail::
bind_traits<boost::tuples::null_type>::type>>,
            Arg1=void (__thiscall S::* )(void),
            Arg2=boost::lambda::placeholder1_type
        ]


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