[Boost-bugs] [Boost C++ Libraries] #4486: C2166: l-value specifies const object error using MSVC 1600 without _DEBUG

Subject: [Boost-bugs] [Boost C++ Libraries] #4486: C2166: l-value specifies const object error using MSVC 1600 without _DEBUG
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-07-29 13:09:56


#4486: C2166: l-value specifies const object error using MSVC 1600 without _DEBUG
--------------------------+-------------------------------------------------
 Reporter: Claudio Bley | Owner: no-maintainer
     Type: Bugs | Status: new
Milestone: Boost 1.44.0 | Component: lambda
  Version: Boost 1.43.0 | Severity: Problem
 Keywords: |
--------------------------+-------------------------------------------------
 Hi.

 For the following test case:
 {{{
 #!c++
 #include <set>
 #include <string>
 #include <algorithm>
 #include <boost/function_output_iterator.hpp>

 #ifdef USE_BLL
 # include <boost/lambda/lambda.hpp>
 # include <boost/lambda/bind.hpp>
 using namespace boost::lambda;
 #else
 # include <boost/bind.hpp>
 using namespace boost;
 #endif

 int main(int argc, char *argv[])
 {
     int a[] = {1, 2, 3, 4};
     typedef std::set<int> aSet;
     typedef std::pair<aSet::iterator, bool> (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<HT,TT> &boost::tuples::cons<HT,TT>::operator =(const
 boost::tuples::cons<HT,TT> &)'
         with
         [
 HT=std::pair<std::_Tree_const_iterator<std::_Tree_val<std::_Tset_traits<int,std::less<int>,std::allocator<int>,false>>>,bool>
 (__thiscall std::set<int>::* const )(const int &),
             TT=boost::tuples::cons<std::set<int> *const
 ,boost::tuples::cons<const
 boost::arg<1>,boost::tuples::detail::map_tuple_to_cons<boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type>::type>>
         ]
         C:\Programme\Boost\include\boost/tuple/detail/tuple_basic.hpp(535)
 : see reference to class template instantiation
 'boost::tuples::cons<HT,TT>' being compiled
         with
         [
 HT=std::pair<std::_Tree_const_iterator<std::_Tree_val<std::_Tset_traits<int,std::less<int>,std::allocator<int>,false>>>,bool>
 (__thiscall std::set<int>::* const )(const int &),
             TT=boost::tuples::cons<std::set<int> *const
 ,boost::tuples::cons<const
 boost::arg<1>,boost::tuples::detail::map_tuple_to_cons<boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type>::type>>
         ]
 C:\Programme\Boost\include\boost/lambda/detail/lambda_functor_base.hpp(422)
 : see reference to class template instantiation
 'boost::tuples::tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9>' being compiled
         with
         [
 T0=std::pair<std::_Tree_const_iterator<std::_Tree_val<std::_Tset_traits<int,std::less<int>,std::allocator<int>,false>>>,bool>
 (__thiscall std::set<int>::* const )(const int &),
             T1=std::set<int> *const ,
             T2=const boost::arg<1>,
 T3=boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,
 T4=boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,
 T5=boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,
 T6=boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,
 T7=boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,
 T8=boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,
 T9=boost::lambda::detail::bind_traits<boost::tuples::null_type>::type
         ]
 C:\Programme\Boost\include\boost/lambda/detail/lambda_functors.hpp(140) :
 see reference to class template instantiation
 'boost::lambda::lambda_functor_base<Act,Args>' being compiled
         with
         [
 Act=boost::lambda::action<3,boost::lambda::function_action<3>>,
 Args=boost::tuples::tuple<std::pair<std::_Tree_const_iterator<std::_Tree_val<std::_Tset_traits<int,std::less<int>,std::allocator<int>,false>>>,bool>
 (__thiscall std::set<int>::* const )(const int &),std::set<int> *const
 ,const
 boost::arg<1>,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,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>
         ]
         C:\sandbox\lambdabug\bug.cpp(25) : see reference to class template
 instantiation 'boost::lambda::lambda_functor<T>' being compiled
         with
         [
 T=boost::lambda::lambda_functor_base<boost::lambda::action<3,boost::lambda::function_action<3>>,boost::tuples::tuple<std::pair<std::_Tree_const_iterator<std::_Tree_val<std::_Tset_traits<int,std::less<int>,std::allocator<int>,false>>>,bool>
 (__thiscall std::set<int>::* const )(const int &),std::set<int> *const
 ,const
 boost::arg<1>,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,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>>
         ]
 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.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4486>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:04 UTC