fix old template + many many typedefs error detected in Udo tremel's template_typedef_rec.i example, and deactive TEMPLATE_QUALIFY cache for problems with OSS
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7993 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
b67cb4e9a0
commit
1f2953ccdd
3 changed files with 118 additions and 6 deletions
|
|
@ -277,6 +277,7 @@ CPP_TEST_CASES += \
|
|||
template_typedef_cplx5 \
|
||||
template_typedef_ns \
|
||||
template_typedef_ptr \
|
||||
template_typedef_rec \
|
||||
template_using \
|
||||
template_virtual \
|
||||
template_whitespace \
|
||||
|
|
|
|||
113
SWIG/Examples/test-suite/template_typedef_rec.i
Normal file
113
SWIG/Examples/test-suite/template_typedef_rec.i
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
%module Tree
|
||||
|
||||
%inline %{
|
||||
// --- includes required to compile the wrapper code ---
|
||||
typedef size_t MY_sizeT;
|
||||
typedef long MY_intT;
|
||||
typedef double MY_floatT;
|
||||
|
||||
class Array
|
||||
{
|
||||
public:
|
||||
typedef MY_intT intT;
|
||||
typedef MY_sizeT sizeT;
|
||||
};
|
||||
|
||||
|
||||
|
||||
template <typename T>
|
||||
class ArrayIterator
|
||||
{
|
||||
public:
|
||||
typedef Array::intT intT;
|
||||
};
|
||||
|
||||
|
||||
template <typename T>
|
||||
class ArrayReverseIterator
|
||||
{
|
||||
public:
|
||||
typedef Array::intT intT;
|
||||
};
|
||||
|
||||
|
||||
template <typename T>
|
||||
class ArrayPrimitiveT
|
||||
: public Array
|
||||
{
|
||||
public:
|
||||
typedef T ValueT;
|
||||
typedef T valueT;
|
||||
typedef ArrayIterator<T> Iterator;
|
||||
typedef ArrayIterator<const T> ConstIterator;
|
||||
typedef ArrayReverseIterator<T> ReverseIterator;
|
||||
typedef ArrayReverseIterator<const T> ConstReverseIterator;
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
class TreeNode
|
||||
{
|
||||
public:
|
||||
typedef T ValueT;
|
||||
typedef T valueT;
|
||||
typedef MY_intT intT;
|
||||
typedef MY_sizeT sizeT;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct ArrayPointerT
|
||||
{
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class TreeIterator
|
||||
{
|
||||
public:
|
||||
typedef MY_intT intT;
|
||||
typedef MY_sizeT sizeT;
|
||||
typedef ArrayPointerT< T* > NodeArrayT;
|
||||
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
class Tree
|
||||
{
|
||||
public:
|
||||
typedef T ValueT;
|
||||
typedef T valueT;
|
||||
typedef MY_intT intT;
|
||||
typedef MY_sizeT sizeT;
|
||||
typedef TreeNode<T> NodeT;
|
||||
typedef ArrayPointerT< NodeT* > NodeArrayT;
|
||||
typedef TreeIterator<NodeT> Iterator;
|
||||
typedef TreeIterator<NodeT> ConstIterator;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
class ModelNode
|
||||
{
|
||||
typedef MY_intT intT;
|
||||
typedef MY_floatT floatT;
|
||||
typedef MY_sizeT sizeT;
|
||||
|
||||
|
||||
};
|
||||
|
||||
class Model
|
||||
{
|
||||
typedef MY_intT intT;
|
||||
typedef MY_sizeT sizeT;
|
||||
typedef Tree<ModelNode> TreeT;
|
||||
typedef TreeT::NodeT TreeNodeT;
|
||||
typedef TreeT::Iterator TreeIteratorT;
|
||||
|
||||
};
|
||||
%}
|
||||
|
||||
|
||||
// --- define ANSI C/C++ declarations to be interfaced ---
|
||||
%template(ModelTree) Tree<ModelNode>;
|
||||
|
|
@ -1392,13 +1392,11 @@ Swig_symbol_isoverloaded(Node *n) {
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
static int no_constructor(Node *n) {
|
||||
#ifdef SWIG_DEBUG
|
||||
Printf(stderr,"node type %s\n", HashGetAttr(n,k_name), type);
|
||||
#endif
|
||||
return !HashCheckAttr(n, k_nodetype, k_constructor);
|
||||
}
|
||||
|
||||
#define SWIG_TEMPLATE_QUALIFY_CACHE
|
||||
/* This cache produce problems with OSS, don't active it */
|
||||
/* #define SWIG_TEMPLATE_QUALIFY_CACHE */
|
||||
static SwigType *
|
||||
Swig_symbol_template_qualify(const SwigType *e, Symtab *st) {
|
||||
String *tprefix, *tsuffix;
|
||||
|
|
@ -1597,14 +1595,14 @@ SwigType *Swig_symbol_typedef_reduce(SwigType *ty, Symtab *tab) {
|
|||
|
||||
n = Swig_symbol_clookup(base,tab);
|
||||
if (!n) {
|
||||
Delete(base);
|
||||
if (SwigType_istemplate(ty)) {
|
||||
SwigType *qt = Swig_symbol_template_reduce(ty,tab);
|
||||
SwigType *qt = Swig_symbol_template_reduce(base,tab);
|
||||
StringAppend(prefix,qt);
|
||||
Delete(qt);
|
||||
#ifdef SWIG_DEBUG
|
||||
Printf(stderr,"symbol_reduce %s %s\n", ty, prefix);
|
||||
#endif
|
||||
Delete(base);
|
||||
return prefix;
|
||||
} else {
|
||||
Delete(prefix);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue