[mpl] possible regression compiling with Visual C++

View: New views
7 Messages — Rating Filter:   Alert me  

[mpl] possible regression compiling with Visual C++

by Edd Dawson-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Re: [mpl] possible regression compiling with Visual C++

by Steven Watanabe-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

AMDG

Edd Dawson wrote:

> 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:
>
> <snip>
>
> 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?
The first problem is that remove is implemented by calling either
push_back or push_front on an empty sequence.  The
error occurs when remove is deciding whether it can use
push_back.  inserter_algorithm.hpp.patch fixes the problem
by calling clear on the argument before running the test.

The second problem is that has_push_back is broken.
push_back_impl.hpp.patch should fix it.

In Christ,
Steven Watanabe


Index: boost/mpl/aux_/inserter_algorithm.hpp
===================================================================
--- boost/mpl/aux_/inserter_algorithm.hpp (revision 54788)
+++ boost/mpl/aux_/inserter_algorithm.hpp (working copy)
@@ -49,7 +49,7 @@
       BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), typename P) \
     > \
 struct name< BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P),na > \
-    : if_< has_push_back<P1> \
+    : if_< has_push_back< typename clear<P1>::type> \
         , aux::name##_impl< \
               BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
             , back_inserter< typename clear<P1>::type > \

Index: boost/mpl/aux_/push_back_impl.hpp
===================================================================
--- boost/mpl/aux_/push_back_impl.hpp (revision 54788)
+++ boost/mpl/aux_/push_back_impl.hpp (working copy)
@@ -25,8 +25,7 @@
 
 namespace boost { namespace mpl {
 
-template< typename Tag >
-struct has_push_back_impl;
+struct has_push_back_arg;
 
 // agurt 05/feb/04: no default implementation; the stub definition is needed
 // to enable the default 'has_push_back' implementation below
@@ -39,7 +38,7 @@
         // if you've got an assert here, you are requesting a 'push_back'
         // specialization that doesn't exist.
         BOOST_MPL_ASSERT_MSG(
-              ( boost::is_same< T, has_push_back_impl<T> >::value )
+              ( boost::is_same< T, has_push_back_arg >::value )
             , REQUESTED_PUSH_BACK_SPECIALIZATION_FOR_SEQUENCE_DOES_NOT_EXIST
             , ( Sequence )
             );
@@ -51,13 +50,13 @@
 {
     template< typename Seq > struct apply
 #if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING)
-        : aux::has_type< push_back< Seq, has_push_back_impl<Tag> > >
+        : aux::has_type< push_back< Seq, has_push_back_arg > >
     {
 #else
     {
-        typedef aux::has_type< push_back< Seq, has_push_back_impl<Tag> > > type;
+        typedef aux::has_type< push_back< Seq, has_push_back_arg > > type;
         BOOST_STATIC_CONSTANT(bool, value =
-              (aux::has_type< push_back< Seq, has_push_back_impl<Tag> > >::value)
+              (aux::has_type< push_back< Seq, has_push_back_arg > >::value)
             );
 #endif
     };

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Re: [mpl] possible regression compiling with Visual C++

by Edd Dawson-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Steven Watanabe wrote:

> The first problem is that remove is implemented by calling either
> push_back or push_front on an empty sequence.  The
> error occurs when remove is deciding whether it can use
> push_back.  inserter_algorithm.hpp.patch fixes the problem
> by calling clear on the argument before running the test.
>
> The second problem is that has_push_back is broken.
> push_back_impl.hpp.patch should fix it.

Thanks very much, Steven. I guess I should file a bug report with your patches
attached?

Kind regards,

Edd

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Re: [mpl] possible regression compiling with Visual C++

by David Abrahams-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


on Wed Jul 08 2009, Edd Dawson <lists-AT-mr-edd.co.uk> wrote:

> Steven Watanabe wrote:
>
>> The first problem is that remove is implemented by calling either
>> push_back or push_front on an empty sequence.  The
>> error occurs when remove is deciding whether it can use
>> push_back.  inserter_algorithm.hpp.patch fixes the problem
>> by calling clear on the argument before running the test.
>>
>> The second problem is that has_push_back is broken.
>> push_back_impl.hpp.patch should fix it.
>
> Thanks very much, Steven. I guess I should file a bug report with your patches
> attached?

Steven, you can go ahead and apply these patches as far as I'm
concerned.

--
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Re: [mpl] possible regression compiling with Visual C++

by Aleksey Gurtovoy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, 14 Jul 2009 02:19:19 -0500, David Abrahams <dave@...>  
wrote:

> Steven, you can go ahead and apply these patches as far as I'm
> concerned.

Yep, please feel free to commit these, they look good to me as well.

TIA,
--
Aleksey Gurtovoy
MetaCommunications Engineering

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Re: [mpl] possible regression compiling with Visual C++

by Steven Watanabe-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

AMDG

Aleksey Gurtovoy wrote:
> On Tue, 14 Jul 2009 02:19:19 -0500, David Abrahams <dave@...>
> wrote:
>
>> Steven, you can go ahead and apply these patches as far as I'm
>> concerned.
>
> Yep, please feel free to commit these, they look good to me as well.

Ok.  I've added a few test cases as well.

In Christ,
Steven Watanabe

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Re: [mpl] possible regression compiling with Visual C++

by Aleksey Gurtovoy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, 14 Jul 2009 11:53:04 -0500, Steven Watanabe <watanabesj@...>  
wrote:

> AMDG
>
> Aleksey Gurtovoy wrote:
>> On Tue, 14 Jul 2009 02:19:19 -0500, David Abrahams <dave@...>  
>> wrote:
>>
>>> Steven, you can go ahead and apply these patches as far as I'm
>>> concerned.
>>
>> Yep, please feel free to commit these, they look good to me as well.
>
> Ok.  I've added a few test cases as well.

Excellent, thanks again!

--
Aleksey Gurtovoy
MetaCommunications Engineering

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost