[C++-sig] Missing address-of operator for overloaded member function

Nicodemus nicodemus at globalite.com.br
Wed Mar 19 06:13:00 CET 2003


Patrick Hartling wrote:

> Thanks to Nicodemus' quick bug fixes, I have made quite a bit more 
> progress with Pyste tonight.  I am now to the point where I am 
> compiling the generated C++ code.  Now, however, I've run into a 
> problem with overloaded member functions wherein the address-of 
> operator (&) is missing in the second argument to 
> boost::python::class_<T>::def().
>
> I have attached an example that results in the following C++ code 
> (using the latest Pyste sources):
>
> BOOST_PYTHON_MODULE(overload)
> {
>     class_< Overload >("Overload", init<  >())
>         .def(init< const Overload & >())
>         .def("data", (void (Overload::*)(int) )Overload::data)
>         .def("data", (int (Overload::*)() )Overload::data)
>     ;
>
> }
>
> The problem appears to be that Function.PointerDeclaration() (in 
> declarations.py) doesn't add the '&' in the pointer-to-member case.  
> I'm still working with GCC 3.2, though I assume other compilers would 
> also fail to compile the above.
>

My main platform is windows using the intel compiler (both at home and 
at work), and it doesn't complain about the missing & operator, which is 
why this bug has lived for so long. 8/

Again, fixed both in the CVS trunk and the RC branch.

>  -Patrick
>
>
> P.S. Pyste really is a great tool.  It's precisely what I needed to 
> jump-start a project I had let stagnate in the last couple of months.


Glad to know. And I want to thank you for your patience with the bugs 
and your clear reports.

Regards,
Nicodemus.






More information about the Cplusplus-sig mailing list