diff --git a/Examples/test-suite/template_forward.i b/Examples/test-suite/template_forward.i index 2aa2b3b0e..aed36e535 100644 --- a/Examples/test-suite/template_forward.i +++ b/Examples/test-suite/template_forward.i @@ -32,12 +32,14 @@ namespace foo { // Class Describable class Describable { public: + void describe() {} }; // Class LinearOpBase template class LinearOpBase : virtual public Describable { public: + }; // end class LinearOpBase // Class VectorBase @@ -45,6 +47,7 @@ namespace foo { class VectorBase : virtual public LinearOpBase { public: + using LinearOpBase::describe; }; // end class VectorBase } diff --git a/Source/Modules/typepass.cxx b/Source/Modules/typepass.cxx index 9fd6c35cf..7d6e278f6 100644 --- a/Source/Modules/typepass.cxx +++ b/Source/Modules/typepass.cxx @@ -778,9 +778,17 @@ class TypePass : private Dispatcher { } else { Node *ns; /* using id */ - - if (Getattr(n,"sym:symtab")) { - ns = Swig_symbol_clookup(Getattr(n,"uname"), Getattr(n,"sym:symtab")); + Symtab *stab = Getattr(n,"sym:symtab"); + if (stab) { + String *uname = Getattr(n,"uname"); + ns = Swig_symbol_clookup(uname, stab); + if (!ns && SwigType_istemplate(uname)) { + String *tmp = Swig_symbol_template_deftype(uname, 0); + if (!Equal(tmp, uname)) { + ns = Swig_symbol_clookup(tmp, stab); + } + Delete(tmp); + } } else { ns = 0; } diff --git a/Source/Swig/symbol.c b/Source/Swig/symbol.c index c01f52791..05acccc34 100644 --- a/Source/Swig/symbol.c +++ b/Source/Swig/symbol.c @@ -1729,7 +1729,6 @@ Swig_symbol_template_defargs(Parm *parms, Parm *targs, Symtab *tscope, Symtab *t * Apply default args to generic template type * ----------------------------------------------------------------------------- */ - #define SWIG_TEMPLATE_DEFTYPE_CACHE SwigType* Swig_symbol_template_deftype(const SwigType *type, Symtab *tscope) { @@ -1787,8 +1786,12 @@ Swig_symbol_template_deftype(const SwigType *type, Symtab *tscope) { String *tsuffix = SwigType_templatesuffix(base); ParmList *tparms = SwigType_function_parms(targs); Node *tempn = Swig_symbol_clookup_local(tprefix,tscope); + if (!tempn && tsuffix && Len(tsuffix)) { + tempn = Swig_symbol_clookup(tprefix,0); + } + #ifdef SWIG_DEBUG - Printf(stderr,"deftype type %s \n", e); + Printf(stderr,"deftype type %s %s %d\n", e, tprefix, (long) tempn); #endif if (tempn) { ParmList *tnargs = HashGetAttr(tempn,k_templateparms);