diff --git a/Examples/test-suite/global_scope_types.i b/Examples/test-suite/global_scope_types.i new file mode 100644 index 000000000..d5bd7ad23 --- /dev/null +++ b/Examples/test-suite/global_scope_types.i @@ -0,0 +1,44 @@ +%module global_scope_types + +// no constructor/destructor wrappers as they do not use global scope operator which we are trying to test here +%nodefaultctor Dingaling; +%nodefaultdtor Dingaling; + +%inline %{ +struct Dingaling {}; +typedef Dingaling DINGALING; +template struct MyTemplate { + T tt(T t) { return t; } + T& ttr(T& t) { return t; } +}; + +#ifndef SWIG +// This is added so that the code will not compile, if the global scope operator on Dingaling is omitted in the generated code +namespace Spac { + class Dingaling { + Dingaling(); + Dingaling(const Dingaling& t); + Dingaling& operator=(const Dingaling t); + }; +} +using namespace Spac; +#endif + +namespace Spac { + + struct Ting {}; + typedef Ting TING; + + class Test { + public: + void something(::Dingaling t, ::Dingaling* pt, ::Dingaling& rt, const ::Dingaling& crt) {} + void tsomething(MyTemplate< ::Dingaling > t1, MyTemplate< const ::Dingaling& > t2) {} +// void usomething(::MyTemplate< ::DINGALING > t3, ::MyTemplate< ::DINGALING *> t4) {} // needs fixing + void nothing(::Spac::Ting*, ::Spac::TING&) {} + }; + +} + +void funcptrtest( void (*)(::Dingaling) ) {} +%} + diff --git a/Examples/test-suite/typemap_template.i b/Examples/test-suite/typemap_template.i new file mode 100644 index 000000000..ad35371cc --- /dev/null +++ b/Examples/test-suite/typemap_template.i @@ -0,0 +1,34 @@ +%module typemap_template + +/* Test bug in 1.3.40 where the presence of a generic/unspecialized typemap caused the incorrect specialized typemap to be used */ + +%typemap(in) SWIGTYPE "/*_this_will_not_compile_SWIGTYPE_ \"$type\" */ " +%typemap(in) const SWIGTYPE & "/*_this_will_not_compile_const_SWIGTYPE_REF_\"$type\" */ " + +%typemap(in) const TemplateTest1 & {$1 = (TemplateTest1 *)0; /* in typemap generic for $type */} +%typemap(in) const TemplateTest1< ZZ > & {$1 = (TemplateTest1 *)0; /* in typemap ZZ for $type */} +%typemap(in) const TemplateTest1< int > & {$1 = (TemplateTest1 *)0; /* in typemap int for $type */} + +%inline %{ +template struct TemplateTest1 { + void setT(const TemplateTest1& t) {} +}; +%} + +%inline %{ + struct YY {}; + struct ZZ {}; +%} + + +%template(TTYY) TemplateTest1< YY >; +%template(TTZZ) TemplateTest1< ZZ >; +%template(TTint) TemplateTest1< int >; + +%inline %{ + void extratest(const TemplateTest1< YY > &t, + const TemplateTest1< ZZ > &tt, + const TemplateTest1< int > &ttt) + {} +%} +