boost-1.31.0 def() and VC7.1.3088 strangeness

Hi, The boost version is the Version_1_31_0 tag from the CVS repository. The VC version is 7.1.3088. Compiling foo.cpp (attached) results in the error reported in BuildLog.htm (attached). The VC options are also in the BuildLog.htm Uncommenting the line in foo.cpp that that begs you to, results in a clean compile. Has anybody else encountered this sort of weirdness?? I'm getting a lot of related behaviour, but this one is simple. #include <boost/python.hpp> using namespace boost::python; class World { public: World(std::string msg): msg(msg) {} // added constructor void set1(std::string msg) throw(std::exception) { this->msg = msg; } void set2(std::string msg) { this->msg = msg; } private: std::string msg; }; void wrap_World(class_<World> &foobar) { // foobar.def("set2", &World::set2); // OK, uncomment this and the compilation works!! foobar.def("set1", &World::set1); // Error on VC7.1 }

For some reason, the BuildLoh.htm is being stubborn. This is a second try to attach it.

OK, I'll paste it inline and attach a zip. Build Log ------- Build started: Project: PyChemistryInterface, Configuration: Release|Win32 ------- Command Lines Creating temporary file "q:\src\pmdcrc\f2\SiroPyGC\src\Vcpp\Release\RSP000001.rsp" with contents [ /Oi /Op /Ot /Oy /I ".\boost" /I "c:\python22\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "NO_ITERATOR_TRAITS" /D "CONVERT_ARRAY_OBJECTS" /D "_WINDLL" /D "_MBCS" /FD /EHsc /MD /GR /YX"stdafx.h" /Fp".\Release/PyChemistryInterface.pch" /Fo".\Release/" /Fd".\Release/" /W3 /c /Zm300 \src\pmdcrc\f2\SiroPyGC\src\foo.cpp ] Creating command line "cl.exe @q:\src\pmdcrc\f2\SiroPyGC\src\Vcpp\Release\RSP000001.rsp /nologo" Output Window Compiling... foo.cpp \src\pmdcrc\f2\SiroPyGC\src\foo.cpp(13) : warning C4290: C++ exception specification ignored except to indicate a function is not __declspec(nothrow) boost\boost\python\detail\invoke.hpp(82) : error C2064: term does not evaluate to a function taking 2 arguments boost\boost\python\detail\caller.hpp(199) : see reference to function template instantiation 'PyObject *boost::python::detail::invoke(boost::python::detail::invoke_tag_,const RC &,F & ,AC0 &,AC1 &)' being compiled with [ ResultConverter=result_converter, T=boost::details::compressed_pair_imp::apply::all_t,boost::mpl::lambda_impl>,boost::python::detail::is_reference_to_class,boost::mpl::not_>>,boost::mpl::void_,boost::mpl::true_>::type>::result_type,2>::first_type, void_return=true, member=false, RC=result_converter, F=boost::details::compressed_pair_imp::apply::all_t,boost::mpl::lambda_impl>,boost::python::detail::is_reference_to_class,boost::mpl::not_>>,boost::mpl::void_,boost::mpl::true_>::type>::result_type,2>::first_type, AC0=c_t0, AC1=c_t1 ] boost\boost\python\detail\caller.hpp(176) : while compiling class-template member function 'PyObject *boost::python::detail::caller_arity<2>::impl::operator ()(PyObject *,PyObject *)' with [ F=void (__thiscall World::* )(std::string) throw(exception), Policies=boost::python::detail::tuple_extract_impl::apply::all_t,boost::mpl::lambda_impl>,boost::python::detail::is_reference_to_class,boost::mpl::not_>>,boost::mpl::void_,boost::mpl::true_>::type>::result_type, Sig=boost::mpl::vector3,World,World>::type &,std::string> ] boost\boost\python\detail\caller.hpp(145) : see reference to class template instantiation 'boost::python::detail::caller_arity<2>::impl' being compiled with [ F=void (__thiscall World::* )(std::string) throw(exception), Policies=boost::python::detail::tuple_extract_impl::apply::all_t,boost::mpl::lambda_impl>,boost::python::detail::is_reference_to_class,boost::mpl::not_>>,boost::mpl::void_,boost::mpl::true_>::type>::result_type, Sig=boost::mpl::vector3,World,World>::type &,std::string> ] boost\boost\python\make_function.hpp(62) : see reference to class template instantiation 'boost::python::detail::caller' being compiled with [ F=void (__thiscall World::* )(std::string) throw(exception), CallPolicies=boost::python::detail::tuple_extract_impl::apply::all_t,boost::mpl::lambda_impl>,boost::python::detail::is_reference_to_class,boost::mpl::not_>>,boost::mpl::void_,boost::mpl::true_>::type>::result_type, Sig=boost::mpl::vector3,World,World>::type &,std::string> ] boost\boost\python\make_function.hpp(147) : see reference to function template instantiation 'boost::python::api::object boost::python::detail::make_function_aux>(F,const CallPolicies &,const Sig &,const boost::python::detail::keyword_range &,NumKeywords)' being compiled with [ F=void (__thiscall World::* )(std::string) throw(exception), CallPolicies=boost::python::detail::tuple_extract_impl::apply::all_t,boost::mpl::lambda_impl>,boost::python::detail::is_reference_to_class,boost::mpl::not_>>,boost::mpl::void_,boost::mpl::true_>::type>::result_type, Signature=boost::mpl::vector3,World,World>::type &,std::string>, BOOST_PP_ITERATION_0=0, Sig=boost::mpl::vector3,World,World>::type &,std::string>, NumKeywords=boost::mpl::int_<0> ] boost\boost\python\class.hpp(542) : see reference to function template instantiation 'boost::python::api::object boost::python::make_function::apply::result_type,boost::python::detail::tuple_extract_impl::apply>::result_type,boost::mpl::vector3>(F,const CallPolicies &,const Keywords &,const Signature &)' being compiled with [ Fn=void (__thiscall World::* )(std::string) throw(exception), Tuple=boost::python::detail::def_helper::all_t, Predicate=boost::mpl::lambda_impl>,boost::python::detail::is_reference_to_class,boost::mpl::not_>>,boost::mpl::void_,boost::mpl::true_>::type, T=boost::mpl::bind1,boost::mpl::lambda_impl::type>, T0=void, T1=boost::mpl::if_,World,World>::type &, T2=std::string, F=void (__thiscall World::* )(std::string) throw(exception), CallPolicies=boost::python::detail::tuple_extract_impl::apply::all_t,boost::mpl::lambda_impl>,boost::python::detail::is_reference_to_class,boost::mpl::not_>>,boost::mpl::void_,boost::mpl::true_>::type>::result_type, Keywords=boost::python::detail::tuple_extract_impl::apply::all_t,boost::mpl::lambda_impl,boost::mpl::void_,boost::mpl::true_>::type>::result_type, Signature=boost::mpl::vector3,World,World>::type &,std::string> ] boost\boost\python\class.hpp(304) : see reference to function template instantiation 'void boost::python::class_::def_impl>(const char *,Fn,const Helper &,...)' being compiled with [ T=World, F=void (__thiscall World::* )(std::string) throw(exception), T1=const char *, Fn=void (__thiscall World::* )(std::string) throw(exception), Helper=boost::python::detail::def_helper ] \src\pmdcrc\f2\SiroPyGC\src\foo.cpp(26) : see reference to function template instantiation 'boost::python::class_::self &boost::python::class_::def(const char *,F)' being compiled with [ T=World, F=void (__thiscall World::* )(std::string) throw(exception) ] Results Build log was saved at "file://q:\src\pmdcrc\f2\SiroPyGC\src\Vcpp\Release\BuildLog.htm" PyChemistryInterface - 1 error(s), 1 warning(s)

Hi Peter, It's best to post Boost.Python questions to the c++-sig: http://www.boost.org/more/mailing_lists.htm#cplussig Peter Hornby <peterho@ned.dem.csiro.au> writes:
Hi,
The boost version is the Version_1_31_0 tag from the CVS repository. The VC version is 7.1.3088.
Compiling foo.cpp (attached) results in the error reported in BuildLog.htm (attached). The VC options are also in the BuildLog.htm
Uncommenting the line in foo.cpp that that begs you to, results in a clean compile. Has anybody else encountered this sort of weirdness?? I'm getting a lot of related behaviour, but this one is simple.
This one is a VC++ bug. It makes exception specifications part of the (member) function's type. Try foobar.def("set1", (void (World::*)(std::string))&World::set1) instead.
#include <boost/python.hpp> using namespace boost::python;
class World { public:
World(std::string msg): msg(msg) {} // added constructor
void set1(std::string msg) throw(std::exception) { this->msg = msg; }
void set2(std::string msg) { this->msg = msg; }
private:
std::string msg; };
void wrap_World(class_<World> &foobar) { // foobar.def("set2", &World::set2); // OK, uncomment this and the compilation works!!
foobar.def("set1", &World::set1); // Error on VC7.1 }
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
-- Dave Abrahams Boost Consulting www.boost-consulting.com
participants (2)
-
David Abrahams
-
Peter Hornby