[C++-sig] another V2 bug
Peter Bienstman
pbienst at MIT.EDU
Wed Apr 3 18:07:43 CEST 2002
Adding a second argument to an otherwise identical function fails to
compile:
#define BOOST_PYTHON_DYNAMIC_LIB
#define BOOST_PYTHON_V2
#include <boost/python/module.hpp>
#include <boost/python/class.hpp>
struct C {};
struct FE {};
struct MWG
{
const FE fe (const C&) {return FE();}
const FE fe2(const C&, const C&) {return FE();}
};
BOOST_PYTHON_MODULE_INIT(m)
{
using namespace boost::python;
module m("m");
m
.add(class_<C>("C"))
.add(class_<FE>("FE"))
.add(
class_<MWG>("MWG")
.def("fe", &MWG::fe) // this compiles.
.def("fe2", &MWG::fe2) // this doesn't.
)
;
}
Compiler output:
pbienst at hunsmac:~/tmp$ g++ -I/home/pbienst/boost_cvs/boost
-I/home/pbienst/local/include/python2.2 -shared boost_test.cpp
/home/pbienst/boost_cvs/boost/boost/python/detail/member_function_cast.hpp: In
static member function `static boost::python::detail::cast_helper<S,
R
(T::*)(A0, A1)>
boost::python::detail::member_function_cast_impl<T>::stage1(R
(S::*)(A0,
A1)) [with S = MWG, R = const FE, A0 = const C&, A1 = const C&, T =
MWG]':
/home/pbienst/boost_cvs/boost/boost/python/class.hpp:99: instantiated
from `boost::python::class_<T, X1, X2, X3>& boost::python::class_<T, X1,
X2, X3>::def(const char*, F) [with F = const FE (MWG::*)(const C&, const
C&), T = MWG, X1 = boost::python::detail::not_specified, X2 =
boost::python::detail::not_specified, X3 =
boost::python::detail::not_specified]'
boost_test.cpp:30: instantiated from here
/home/pbienst/boost_cvs/boost/boost/python/detail/member_function_cast.hpp:68: conversion
from `boost::python::detail::cast_helper<const FE (MWG::*)(const C&,
const
C&), const FE (MWG::*)(const C&, const C&)>' to non-scalar type
`boost::python::detail::cast_helper<MWG, const FE (MWG::*)(const C&,
const
C&)>' requested
More information about the Cplusplus-sig
mailing list