swig generated code can not be compiled when option -nortti is used and %feature("director") is enabled for a c++ class
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
swig1.3 (Ubuntu) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: swig1.3
Package: 1.3.33-2ubuntu1 (Ubuntu hardy)
Target language: Python
Swig provides the option -nortti to be used in conjunction with C++ code, which is compiled with -fno-rtti. This takes effect only if "directors" are used. It defines SWIG_DIRECTOR_
From the swig source code (Source/
#ifdef SWIG_DIRECTOR_
/*
When we don't use the native C++ RTTI, we implement a minimal one
only for Directors.
*/
[...]
# define SWIG_DIRECTOR_
# define SWIG_DIRECTOR_
#else
# define SWIG_DIRECTOR_
# define SWIG_DIRECTOR_
#endif /* SWIG_DIRECTOR_
The reason is that dynamic_cast<> must not be used with -fno-rtti. However, swig doesn't use the preprocessor macro defined above in one case, namely in Language:
You can work around this problem by applying the attached patch to swig, probably breaking other target languages.
Is this symptom still reproducible in 8.10 or 9.04?