[C++-sig] cvs update breaks some code (class_metadata.hpp)

Brett Calcott brett at coombs.anu.edu.au
Thu Jan 12 03:39:03 CET 2006


Hi,

I have just updated from CVS. Some code of mine no longer compiles. I am 
using VC 7.1 on Window XP Prof.

Here is a short piece of code that compiles with CVS update from 1st 
August 05, but not with the latest from 12th January 06.

The problem occurs in class_metadata.hpp. A copy of the error produced 
is below the code.

I will investigate further, in the weekend. For now, if anyone has any 
clues, let me know.

Cheers,
Brett

****** CODE BEGINS


#include <boost/python/call_method.hpp>
#include <boost/python/wrapper.hpp>
#include <boost/python/def.hpp>
#include <boost/python/class.hpp>
#include <boost/python/list.hpp>
#include <boost/python/tuple.hpp>
#include <boost/python/def.hpp>
#include <boost/python/module.hpp>

using namespace boost::python;

struct base {
     base() {}
     virtual int a_function(int a) { return 0; }
};

struct python_base : base, wrapper<base>
{
     python_base() : base() {}

     int a_function(int a)
     {
         if (override f = this->get_override("a_function"))
             return f(a);
         return base::a_function(a);
     }

     int default_a_function(int a) { return this->base::a_function(a); }
};

struct cpp_derived : base, wrapper<base>
{
     cpp_derived() : base() {}

     int a_function(int a)
     {
         return a * 666;
     }
};

int call_a_function(base &base, int i)
{
     return base.a_function(i);
}

BOOST_PYTHON_MODULE(simple)
{
     class_<base
         , boost::noncopyable
         >("_BaseNotUsed")
         ;

     // Base for all python classes
     class_<python_base
         , bases<base>
         , boost::noncopyable
         >("PythonBase")
         .def(init<python_base>())
         .def("a_function", &base::a_function, 
&python_base::default_a_function)
         ;

     // A C++ derived class
     class_<cpp_derived
         , bases<base>
         , boost::noncopyable
         >("SimpleEvolver")
         .def(init<cpp_derived>())
         ;

     def("call_a_function", &call_a_function);
}

******** END OF CODE

The error is a follows:

d:\boost\boost\python\object\class_metadata.hpp(57) : error C2664: 
'boost::mpl::assertion_failed' : cannot convert parameter 1 from 
'boost::mpl::failed ************boost::mpl::not_<T>::* *********** 
                  ' to 'boost::mpl::assert<false>::type'
         with
         [
 
T=boost::is_same<base,boost::python::objects::class_metadata<base,boost::noncopyable,boost::python::detail::not_specified,boost::python::detail::not_specified>::wrapped>
         ]
         A reference that is not to 'const' cannot be bound to a non-lvalue
         d:\boost\boost\mpl\for_each.hpp(73) : see reference to function 
template instantiation 'void 
boost::python::objects::register_base_of<Derived>::operator 
()<boost::detail::add_pointer_impl<T>::no_ref_type>(Base *) const' being 
compiled
         with
         [
             Derived=base,
 
T=boost::mpl::aux::resolve_bind_arg<boost::mpl::bind1<boost::mpl::quote1<boost::add_pointer,boost::mpl::void_>,boost::mpl::lambda<boost::mpl::_,boost::mpl::void_>::result_>::apply<item>::a1,item,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na>::type,
 
Base=boost::detail::add_pointer_impl<boost::mpl::aux::resolve_bind_arg<boost::mpl::bind1<boost::mpl::quote1<boost::add_pointer,boost::mpl::void_>,boost::mpl::lambda<boost::mpl::_,boost::mpl::void_>::result_>::apply<item>::a1,item,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na>::type>::no_ref_type
         ]
         d:\boost\boost\mpl\for_each.hpp(97) : see reference to function 
template instantiation 'void 
boost::mpl::aux::for_each_impl<false>::execute<first,last,TransformOp,F>(Iterator 
*,LastIterator *,TransformFunc *,F)' being compiled
         with
         [
             TransformOp=boost::add_pointer<boost::mpl::_>,
             F=boost::python::objects::register_base_of<base>,
             Iterator=first,
             LastIterator=last,
             TransformFunc=boost::add_pointer<boost::mpl::_>
         ]
         d:\boost\boost\python\object\class_metadata.hpp(98) : see 
reference to function template instantiation 'void 
boost::mpl::for_each<Bases,boost::add_pointer<T>,boost::python::objects::register_base_of<Derived>>(F,Sequence 
*,TransformOp *)' being compiled
         with
         [
             Bases=boost::python::bases<base>,
             T=boost::mpl::_,
             Derived=base,
             F=boost::python::objects::register_base_of<base>,
             Sequence=boost::python::bases<base>,
             TransformOp=boost::add_pointer<boost::mpl::_>
         ]
         d:\boost\boost\python\object\class_metadata.hpp(225) : see 
reference to function template instantiation 'void 
boost::python::objects::register_shared_ptr_from_python_and_casts<T2,boost::python::bases<Base0>>(T 
*,Bases)' being compiled
         with
         [
             T2=base,
             Base0=base,
             T=base,
             Bases=boost::python::bases<base>
         ]
         d:\boost\boost\python\object\class_metadata.hpp(213) : see 
reference to function template instantiation 'void 
boost::python::objects::class_metadata<T,X1,X2,X3>::register_aux2<T2,boost::mpl::bool_<C_>>(T2 
*,Callback)' being compiled
         with
         [
             T=python_base,
             X1=boost::python::bases<base>,
             X2=boost::noncopyable,
             X3=boost::python::detail::not_specified,
             T2=base,
             C_=true,
             Callback=boost::mpl::bool_<true>
         ]
         d:\boost\boost\python\object\class_metadata.hpp(205) : see 
reference to function template instantiation 'void 
boost::python::objects::class_metadata<T,X1,X2,X3>::register_aux<base>(boost::python::wrapper<base> 
*)' being compiled
         with
         [
             T=python_base,
             X1=boost::python::bases<base>,
             X2=boost::noncopyable,
             X3=boost::python::detail::not_specified
         ]
         d:\boost\boost\python\object\class_metadata.hpp(204) : while 
compiling class-template member function 'void 
boost::python::objects::class_metadata<T,X1,X2,X3>::register_(void)'
         with
         [
             T=python_base,
             X1=boost::python::bases<base>,
             X2=boost::noncopyable,
             X3=boost::python::detail::not_specified
         ]
         d:\boost\boost\python\class.hpp(174) : see reference to class 
template instantiation 
'boost::python::objects::class_metadata<T,X1,X2,X3>' being compiled
         with
         [
             T=python_base,
             X1=boost::python::bases<base>,
             X2=boost::noncopyable,
             X3=boost::python::detail::not_specified
         ]
         d:\boost\boost\python\class.hpp(627) : see reference to class 
template instantiation 'boost::python::class_<W,X1,X2>::id_vector' being 
compiled
         with
         [
             W=python_base,
             X1=boost::python::bases<base>,
             X2=boost::noncopyable
         ]
         C:\Program Files\Microsoft Visual Studio .NET 
2003\Vc7\include\xmemory(156) : while compiling class-template member 
function 'boost::python::class_<W,X1,X2>::class_(const char *,const char *)'
         with
         [
             W=python_base,
             X1=boost::python::bases<base>,
             X2=boost::noncopyable
         ]
         test.cpp(58) : see reference to class template instantiation 
'boost::python::class_<W,X1,X2>' being compiled
         with
         [
             W=python_base,
             X1=boost::python::bases<base>,
             X2=boost::noncopyable
         ]
d:\boost\boost\python\object\class_metadata.hpp(57) : fatal error C1903: 
unable to recover from previous error(s); stopping compilation










More information about the Cplusplus-sig mailing list