%module conversion_ns_template %{ namespace oss { struct Hi { Hi(){} Hi(int){} }; enum Test {One, Two}; template struct Foo { Foo(){} }; template struct Bar { Bar(){ } Bar(int){ } #if !defined(__SUNPRO_CC) operator int() { return 0; } #endif operator int&() { static int num = 0; return num; } #if !defined(__SUNPRO_CC) operator Foo() { return Foo(); } #endif operator Foo&() { return *(new Foo()); } }; } %} namespace oss { enum Test {One, Two}; // these works %ignore Hi::Hi(); %rename(create) Hi::Hi(int); struct Hi { Hi(); Hi(int); }; template struct Foo { Foo(); }; // these works %rename(hello1) Bar::operator int&(); %ignore Bar::operator int(); %rename(hello2) Bar::operator Foo&(); %ignore Bar::operator Foo(); // these don't %ignore Bar::Bar(); %rename(Bar_create) Bar::Bar(int); template struct Bar { Bar(); Bar(int); operator int(); operator int&(); operator Foo(); operator Foo&(); }; } namespace oss { %template(Foo_One) Foo; %template(Bar_One) Bar; }