fix template forward + using

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8547 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2006-01-24 22:23:12 +00:00
commit 654efd7ba5
3 changed files with 19 additions and 5 deletions

View file

@ -32,12 +32,14 @@ namespace foo {
// Class Describable // Class Describable
class Describable { class Describable {
public: public:
void describe() {}
}; };
// Class LinearOpBase // Class LinearOpBase
template<class RangeScalar, class DomainScalar> template<class RangeScalar, class DomainScalar>
class LinearOpBase : virtual public Describable { class LinearOpBase : virtual public Describable {
public: public:
}; // end class LinearOpBase<RangeScalar,DomainScalar> }; // end class LinearOpBase<RangeScalar,DomainScalar>
// Class VectorBase // Class VectorBase
@ -45,6 +47,7 @@ namespace foo {
class VectorBase : virtual public LinearOpBase<Scalar> class VectorBase : virtual public LinearOpBase<Scalar>
{ {
public: public:
using LinearOpBase<Scalar>::describe;
}; // end class VectorBase<Scalar> }; // end class VectorBase<Scalar>
} }

View file

@ -778,9 +778,17 @@ class TypePass : private Dispatcher {
} else { } else {
Node *ns; Node *ns;
/* using id */ /* using id */
Symtab *stab = Getattr(n,"sym:symtab");
if (Getattr(n,"sym:symtab")) { if (stab) {
ns = Swig_symbol_clookup(Getattr(n,"uname"), Getattr(n,"sym:symtab")); 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 { } else {
ns = 0; ns = 0;
} }

View file

@ -1729,7 +1729,6 @@ Swig_symbol_template_defargs(Parm *parms, Parm *targs, Symtab *tscope, Symtab *t
* Apply default args to generic template type * Apply default args to generic template type
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
#define SWIG_TEMPLATE_DEFTYPE_CACHE #define SWIG_TEMPLATE_DEFTYPE_CACHE
SwigType* SwigType*
Swig_symbol_template_deftype(const SwigType *type, Symtab *tscope) { 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); String *tsuffix = SwigType_templatesuffix(base);
ParmList *tparms = SwigType_function_parms(targs); ParmList *tparms = SwigType_function_parms(targs);
Node *tempn = Swig_symbol_clookup_local(tprefix,tscope); Node *tempn = Swig_symbol_clookup_local(tprefix,tscope);
if (!tempn && tsuffix && Len(tsuffix)) {
tempn = Swig_symbol_clookup(tprefix,0);
}
#ifdef SWIG_DEBUG #ifdef SWIG_DEBUG
Printf(stderr,"deftype type %s \n", e); Printf(stderr,"deftype type %s %s %d\n", e, tprefix, (long) tempn);
#endif #endif
if (tempn) { if (tempn) {
ParmList *tnargs = HashGetAttr(tempn,k_templateparms); ParmList *tnargs = HashGetAttr(tempn,k_templateparms);