Boost logo

Boost :

Subject: [boost] [mpl] possible regression compiling with Visual C++
From: Edd Dawson (lists_at_[hidden])
Date: 2009-07-07 22:33:40


Hi folks,

The following code compiles fine against Boost 1.34.1 and 1.35.0, but apparently
not anything later. I've tried 1.36.0 and 1.39.0.

I'm compiling with Microsoft's Visual C++ 2005 and 2009 compilers (the express
editions if it matters).

#include <boost/mpl/remove.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>

template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_MPL_LIMIT_VECTOR_SIZE,
typename T, void)>
struct X
{
     typedef typename
         boost::mpl::vector<BOOST_PP_ENUM_PARAMS(BOOST_MPL_LIMIT_VECTOR_SIZE,
T)>::type
         template_parameters; // mpl::vector of template parameters

     typedef typename boost::mpl::remove
     <
         template_parameters,
         void
>
     ::type template_parameters_no_voids; // voids removed
};

int main()
{
     X<int> x;
     return 0;
}

The error messages using Boost 1.39.0 and Visual C++ 2005:

mpl_regression.cpp
M:\libs\boost\1.39.0\boost/mpl/aux_/push_back_impl.hpp(45) : error C2664:
'boost::mpl::assertion_failed' : cannot convert parameter 1 from
'boost::mpl::failed ************(__thiscall
boost::mpl::push_back_impl<Tag>::apply<Sequence,T>::REQUESTED_PUSH_BACK_SPECIALIZATION_FOR_SEQUENCE_DOES_NOT_EXIST::*
***********)(Sequence)' to 'boost::mpl::assert<false>::type'
         with
         [
             Tag=boost::mpl::aux::vector_tag<20>,
 
Sequence=boost::mpl::vector20<int,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void>,
             T=boost::mpl::has_push_back_impl<boost::mpl::aux::vector_tag<20>>
         ]
         No constructor could take the source type, or constructor overload
resolution was ambiguous
         M:\libs\boost\1.39.0\boost/mpl/push_back.hpp(32) : see reference to
class template instantiation
'boost::mpl::push_back_impl<Tag>::apply<Sequence,T>' being compiled
         with
         [
             Tag=boost::mpl::aux::vector_tag<20>,
 
Sequence=boost::mpl::vector20<int,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void>,
             T=boost::mpl::has_push_back_impl<boost::mpl::aux::vector_tag<20>>
         ]
         M:\libs\boost\1.39.0\boost/mpl/aux_/has_type.hpp(20) : see reference to
class template instantiation 'boost::mpl::push_back<Sequence,T>' being compiled
         with
         [
 
Sequence=boost::mpl::vector20<int,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void>,
             T=boost::mpl::has_push_back_impl<boost::mpl::aux::vector_tag<20>>
         ]
         M:\libs\boost\1.39.0\boost/mpl/aux_/push_back_impl.hpp(55) : see
reference to class template instantiation 'boost::mpl::aux::has_type<T>' being
compiled
         with
         [
 
T=boost::mpl::push_back<boost::mpl::vector20<int,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void>,boost::mpl::has_push_back_impl<boost::mpl::aux::vector_tag<20>>>
         ]
         M:\libs\boost\1.39.0\boost/mpl/push_back.hpp(43) : see reference to
class template instantiation 'boost::mpl::has_push_back_impl<Tag>::apply<Seq>'
being compiled
         with
         [
             Tag=boost::mpl::aux::vector_tag<20>,
 
Seq=boost::mpl::vector20<int,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void>
         ]
         M:\libs\boost\1.39.0\boost/mpl/if.hpp(63) : see reference to class
template instantiation 'boost::mpl::has_push_back<Sequence>' being compiled
         with
         [
 
Sequence=boost::mpl::vector20<int,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void>
         ]
         M:\libs\boost\1.39.0\boost/mpl/remove.hpp(48) : see reference to class
template instantiation 'boost::mpl::if_<T1,T2,T3>' being compiled
         with
         [
 
T1=boost::mpl::has_push_back<boost::mpl::vector20<int,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void>>,
 
T2=boost::mpl::aux::remove_impl<boost::mpl::vector20<int,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void>,void,boost::mpl::back_inserter<boost::mpl::clear_impl<boost::mpl::aux::vector_tag<20>>::apply<boost::mpl::vector20<int,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void>>::type>>,
 
T3=boost::mpl::aux::reverse_remove_impl<boost::mpl::vector20<int,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void>,void,boost::mpl::front_inserter<boost::mpl::clear_impl<boost::mpl::aux::vector_tag<20>>::apply<boost::mpl::vector20<int,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void>>::type>>
         ]
         mpl_regression.cpp(18) : see reference to class template instantiation
'boost::mpl::remove<P1,P2>' being compiled
         with
         [
 
P1=boost::mpl::vector20<int,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void>,
             P2=void
         ]
         mpl_regression.cpp(23) : see reference to class template instantiation
'X<T0>' being compiled
         with
         [
             T0=int
         ]
M:\libs\boost\1.39.0\boost/mpl/aux_/push_back_impl.hpp(45) : error C2866:
'boost::mpl::push_back_impl<Tag>::apply<Sequence,T>::mpl_assertion_in_line_6' :
a const static data member of a managed type must be initialized at the point of
declaration
         with
         [
             Tag=boost::mpl::aux::vector_tag<20>,
 
Sequence=boost::mpl::vector20<int,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void,void>,
             T=boost::mpl::has_push_back_impl<boost::mpl::aux::vector_tag<20>>
         ]

Is this a problem with more recent versions of Boost, or am I doing something
wrong?

It looks like it's complaining because an mpl::vector of maximal static size
doesn't implement push_back, but it surely shouldn't need to for a remove operation?

Kind regards,

Edd


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