diff --git a/SWIG/Examples/test-suite/python/simutry.i b/SWIG/Examples/test-suite/python/simutry.i index 6c3457108..cf9bdd3c4 100644 --- a/SWIG/Examples/test-suite/python/simutry.i +++ b/SWIG/Examples/test-suite/python/simutry.i @@ -2,16 +2,15 @@ %include "std_vector.i" -%inline -{ -#include +%inline { namespace simuPOP { // some simple pop class - struct pop { + template + struct Population { int m_a; - pop(int a):m_a(a){} + Population(int a):m_a(a){} }; // base operator, output pop.m_a @@ -32,9 +31,40 @@ namespace simuPOP virtual int func() const { return 2*this->m_pop.m_a; } }; + } + } +#if 1 +namespace simuPOP +{ + %template(population) Population< std::pair >; +} + +%inline +{ + namespace simuPOP + { + typedef Population< std::pair > pop; + } +} +#else +%inline +{ + namespace simuPOP + { + // %template(population) Population< std::pair >; + + struct pop { + int m_a; + pop(int a):m_a(a){} + }; + } +} +#endif + + namespace simuPOP { %template(baseOperator) Operator< pop >; diff --git a/SWIG/Source/Modules/typepass.cxx b/SWIG/Source/Modules/typepass.cxx index 7d6e278f6..38d53b471 100644 --- a/SWIG/Source/Modules/typepass.cxx +++ b/SWIG/Source/Modules/typepass.cxx @@ -353,9 +353,9 @@ class TypePass : private Dispatcher { // We need to fully resolve the name to make templates work correctly */ Node *cn; fname = SwigType_typedef_resolve_all(name); - if (Strcmp(fname,name) != 0) { - cn = Swig_symbol_clookup_local(fname,0); - if ((!cn) || (Strcmp(nodeType(cn),"template") == 0) + if (Strcmp(fname,name) != 0 && (cn = Swig_symbol_clookup_local(fname,0))) { + if ((n == cn) + || (Strcmp(nodeType(cn),"template") == 0) || (Getattr(cn,"feature:onlychildren") != 0) || (Getattr(n,"feature:onlychildren") != 0)) { Swig_symbol_cadd(fname,n);