From: SourceForge.net <no...@so...> - 2011-07-28 19:14:48
|
Bugs item #3191275, was opened at 2011-02-24 14:01 Message generated for change (Comment added) made by wsfulton You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=3191275&group_id=1645 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: python Group: None >Status: Closed Resolution: Fixed Priority: 5 Private: No Submitted By: Michel Zou (xantares09) Assigned to: Nobody/Anonymous (nobody) Summary: invalid parenthesis around template argument Initial Comment: Hi, Current swig (2.0.2) doesn't like this smart pointer pattern : %module example %inline %{ template <class T> class SmartPointer { public: inline const T * operator -> () const {} inline T * operator -> () {} }; class FooImplementation { public: static void Bar(); }; %} %template(FooImplementationSmartPointer) SmartPointer<FooImplementation>; I get this error : common_wrap.cpp: In function ‘PyObject* _wrap_FooImplementationSmartPointer_Bar(PyObject*, PyObject*)’: common_wrap.cpp:2988: error: template argument 1 is invalid common_wrap.cpp:2988: error: expected ‘)’ before ‘const’ common_wrap.cpp:2988: error: expected ‘)’ before ‘;’ token make[1]: *** [_common_la-common_wrap.lo] Error 1 The following code is generated : SWIGINTERN PyObject *_wrap_FooImplementationSmartPointer_Bar(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; SmartPointer< FooImplementation > *arg1 = (SmartPointer< FooImplementation > *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:FooImplementationSmartPointer_Bar",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_SmartPointerT_FooImplementation_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FooImplementationSmartPointer_Bar" "', argument " "1"" of type '" "SmartPointer< FooImplementation > *""'"); } arg1 = reinterpret_cast< SmartPointer< FooImplementation > * >(argp1); (*(SmartPointer<(FooImplementation)> const *)arg1)->Bar(); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } We can see the following line is incorrect : (*(SmartPointer<(FooImplementation)> const *)arg1)->Bar(); Regards. ---------------------------------------------------------------------- >Comment By: William Fulton (wsfulton) Date: 2011-07-28 19:14 Message: Closing ---------------------------------------------------------------------- Comment By: Michel Zou (xantares09) Date: 2011-07-28 10:19 Message: It has been fixed in 2.0.3 ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=3191275&group_id=1645 |