diff --git a/Examples/test-suite/template_enum.i b/Examples/test-suite/template_enum.i index 46a92facd..0d6fbf5b9 100644 --- a/Examples/test-suite/template_enum.i +++ b/Examples/test-suite/template_enum.i @@ -13,3 +13,29 @@ public: %template(foo_i) foo; %template(foo_d) foo; + +%inline { + +namespace Manta { + template class ColorSpace { + public: + typedef typename Traits::ComponentType ComponentType; + enum { NumComponents = Traits::NumComponents}; + + ComponentType data[NumComponents]; + }; +} + +namespace Manta { + class RGBTraits { + public: + typedef float ComponentType; + enum {NumComponents = 3}; + }; +} +} + + +namespace Manta { + %template(Color) ColorSpace; +}; diff --git a/Source/Swig/symbol.c b/Source/Swig/symbol.c index 31a68e215..248180ff3 100644 --- a/Source/Swig/symbol.c +++ b/Source/Swig/symbol.c @@ -1415,6 +1415,11 @@ Swig_symbol_type_qualify(const SwigType *t, Symtab *st) { List *elements; String *result = NewStringEmpty(); int i,len; + char *c = Char(t); + if (strncmp(c,"::",2) == 0) { + StringAppend(result, t); + return result; + } elements = SwigType_split(t); diff --git a/Source/Swig/typeobj.c b/Source/Swig/typeobj.c index 24c92f800..f8b73c494 100644 --- a/Source/Swig/typeobj.c +++ b/Source/Swig/typeobj.c @@ -595,7 +595,17 @@ SwigType_array_getdim(SwigType *t, int n) { c++; n--; } - if (n == 0) return SwigType_parm(c); + if (n == 0) { + String *dim = SwigType_parm(c); + if (SwigType_istemplate(dim)) { + String *ndim = SwigType_namestr(dim); + Delete(dim); + dim = ndim; + } + + return dim; + } + return 0; }