Pyste and overloaded virtual functions.
Hi, Sorry to bother you like this every few hours but I've found another bug with Pyste (previous version) when generating code for overloaded virtual functions. Here is a test program. // ---------- overload.hpp ---------- namespace test { class Base { public: virtual void f(const int i) = 0; }; class A : public Base{ public: void f(const int i) {} void f(const double d, const int i) {} }; } // -------------------- When compiling the file that Pyste generates for this, it produces this error message: overload.cpp: In function `void init_module_overload()': overload.cpp:59: no matching function for call to `boost::python::class_<test::A,{anonymous}::test_A_Wrapper,boost::python::detail::not_specified,boost::python::detail::not_specified>::def (const char[2], {unknown type}, void ({anonymous}::test_A_Wrapper::*)(int))' The generated code segment for the function looks like this: .def("f", &test::A::f, &test_A_Wrapper::default_f) .def("f", (void (test::A::*)(const double, const int) )&test::A::f) The fix is to replace it like so: .def("f", (void (test::A::*)(const int) ) &test::A::f, &test_A_Wrapper::default_f) .def("f", (void (test::A::*)(const double, const int) )&test::A::f) Only the first line is changed. I've also attached a patch to ClassExporter.py that fixes this for me. Oh! I just spent an hour and a half debugging this but it looks like this was fixed in the latest version that has the _name bug. FWIW, I've attached the patch anyway but this patch is for the ClassExporter.py version 1.29. cheers, prabhu
Prabhu Ramachandran wrote:
Hi,
Sorry to bother you like this every few hours but I've found another bug with Pyste (previous version) when generating code for overloaded virtual functions. Here is a test program.
// ---------- overload.hpp ---------- namespace test { class Base { public: virtual void f(const int i) = 0; };
class A : public Base{ public: void f(const int i) {} void f(const double d, const int i) {} }; } // --------------------
<snip error> The generated code segment for the function looks like this:
.def("f", &test::A::f, &test_A_Wrapper::default_f) .def("f", (void (test::A::*)(const double, const int) )&test::A::f)
The fix is to replace it like so:
.def("f", (void (test::A::*)(const int) ) &test::A::f, &test_A_Wrapper::default_f) .def("f", (void (test::A::*)(const double, const int) )&test::A::f)
Only the first line is changed. I've also attached a patch to ClassExporter.py that fixes this for me. Oh! I just spent an hour and a half debugging this but it looks like this was fixed in the latest version that has the _name bug. FWIW, I've attached the patch anyway but this patch is for the ClassExporter.py version 1.29.
Yeah, it is fixed in the new version, but thanks for the patch anyway! 8) Regards, Nicodemus.
participants (2)
-
Nicodemus -
Prabhu Ramachandran