id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 4486,C2166: l-value specifies const object error using MSVC 1600 without _DEBUG,Claudio Bley,No-Maintainer,"Hi. For the following test case: {{{ #!c++ #include #include #include #include #ifdef USE_BLL # include # include using namespace boost::lambda; #else # include using namespace boost; #endif int main(int argc, char *argv[]) { int a[] = {1, 2, 3, 4}; typedef std::set aSet; typedef std::pair (aSet::*si)(const aSet::value_type&); aSet s; si set_insert = &aSet::insert; std::copy(a, a + sizeof(a) / sizeof(*a), boost::make_function_output_iterator( bind(set_insert, &s, _1))); } }}} I receive this error when compiling in ""Release mode"" (I'm using CMake) using Visual Studio 10 x86 on Windows XP SP3 with : {{{ C:\Programme\Boost\include\boost/tuple/detail/tuple_basic.hpp(383) : error C2166: l-value specifies const object C:\Programme\Boost\include\boost/tuple/detail/tuple_basic.hpp(382) : while compiling class template member function 'boost::tuples::cons &boost::tuples::cons::operator =(const boost::tuples::cons &)' with [ HT=std::pair,std::allocator,false>>>,bool> (__thiscall std::set::* const )(const int &), TT=boost::tuples::cons *const ,boost::tuples::cons,boost::tuples::detail::map_tuple_to_cons::type>> ] C:\Programme\Boost\include\boost/tuple/detail/tuple_basic.hpp(535) : see reference to class template instantiation 'boost::tuples::cons' being compiled with [ HT=std::pair,std::allocator,false>>>,bool> (__thiscall std::set::* const )(const int &), TT=boost::tuples::cons *const ,boost::tuples::cons,boost::tuples::detail::map_tuple_to_cons::type>> ] C:\Programme\Boost\include\boost/lambda/detail/lambda_functor_base.hpp(422) : see reference to class template instantiation 'boost::tuples::tuple' being compiled with [ T0=std::pair,std::allocator,false>>>,bool> (__thiscall std::set::* const )(const int &), T1=std::set *const , T2=const boost::arg<1>, T3=boost::lambda::detail::bind_traits::type, T4=boost::lambda::detail::bind_traits::type, T5=boost::lambda::detail::bind_traits::type, T6=boost::lambda::detail::bind_traits::type, T7=boost::lambda::detail::bind_traits::type, T8=boost::lambda::detail::bind_traits::type, T9=boost::lambda::detail::bind_traits::type ] C:\Programme\Boost\include\boost/lambda/detail/lambda_functors.hpp(140) : see reference to class template instantiation 'boost::lambda::lambda_functor_base' being compiled with [ Act=boost::lambda::action<3,boost::lambda::function_action<3>>, Args=boost::tuples::tuple,std::allocator,false>>>,bool> (__thiscall std::set::* const )(const int &),std::set *const ,const boost::arg<1>,boost::lambda::detail::bind_traits::type,boost::lambda::detail::bind_traits::type,boost::lambda::detail::bind_traits::type,boost::lambda::detail::bind_traits::type,boost::lambda::detail::bind_traits::type,boost::lambda::detail::bind_traits::type,boost::lambda::detail::bind_traits::type> ] C:\sandbox\lambdabug\bug.cpp(25) : see reference to class template instantiation 'boost::lambda::lambda_functor' being compiled with [ T=boost::lambda::lambda_functor_base>,boost::tuples::tuple,std::allocator,false>>>,bool> (__thiscall std::set::* const )(const int &),std::set *const ,const boost::arg<1>,boost::lambda::detail::bind_traits::type,boost::lambda::detail::bind_traits::type,boost::lambda::detail::bind_traits::type,boost::lambda::detail::bind_traits::type,boost::lambda::detail::bind_traits::type,boost::lambda::detail::bind_traits::type,boost::lambda::detail::bind_traits::type>> ] NMAKE : fatal error U1077: 'C:\PROGRA~1\MICROS~2.0\VC\bin\cl.exe' : return code '0x2' Stop. NMAKE : fatal error U1077: '""C:\Programme\Microsoft Visual Studio 10.0\VC\BIN\nmake.exe""' : return code '0x2' Stop. NMAKE : fatal error U1077: '""C:\Programme\Microsoft Visual Studio 10.0\VC\BIN\nmake.exe""' : return code '0x2' Stop. }}} The command line used to compile is the following: {{{ cl /DWIN32 /D_WINDOWS /D_SCL_SECURE_NO_WARNINGS /Zm1000 /DUSE_BLL -IC:\Programme\Boost\include /Fobug.cpp.obj -c C:\sandbox\lambdabug\bug.cpp }}} When defining the _DEBUG preprocessor variable, or when using Boost Bind instead it compiles successfully.",Bugs,closed,Boost 1.44.0,lambda,Boost 1.43.0,Problem,invalid,,