Hello,
I just found a case where the code generated by py++ doesn't compile. A method of the class wrapper tries to call the original class's method, but without giving the correct template parameter in the call, resulting in a compilation error.
Here is an extract of my class (complete test case attached)
--
class Foo
{
...
protected:
template< typename T > void method_( std::vector< T > &vec );
};
--
Py++ generates this:
--
struct Foo_wrapper : Foo, bp::wrapper< Foo >
{
...
void method_( ::std::vector< int > &vec )
{
Foo::method_( boost::ref(vec) );
^======== misses the '<int>'
}
};
--
Note that if I use 'T' instead of 'std::vector<T>', then it compiles fine. Here, the compiler apparently can't decide based on 'boost::ref(vec)' type which T to use.
To reproduce:
> python py_bug_reproduce.py
warning W1031: `Py++` will generate class wrapper - user asked to expose non - public member function "method_"
> g++ -c -o generated/Foo.pypp.o -I/software/tools/include/boost/1.36.0 -I/software/python/2.5.1/linux.centos4.x86_64/include/python2.5 generated/Foo.pypp.cpp
generated/Foo.pypp.cpp: In member function ‘void Foo_wrapper::method_(std::vector<int, std::allocator<int> >&)’:
generated/Foo.pypp.cpp:38: error: no matching function for call to ‘Foo_wrapper::method_(const boost::reference_wrapper<std::vector<int, std::allocator<int> > >)’
Is the error caused by what py++ warns about? (W1031)
If I remove the 'protected:' line from Foo class, py++ doesn't generate any code for method_ in Foo_wrapper, and binds the Foo method directly, which successfully compiles.
Thanks!
Benoit
|