diff --git a/SWIG/Examples/test-suite/common.mk b/SWIG/Examples/test-suite/common.mk index 2d792649c..b9e9e3af4 100644 --- a/SWIG/Examples/test-suite/common.mk +++ b/SWIG/Examples/test-suite/common.mk @@ -282,6 +282,7 @@ CPP_TEST_CASES += \ typemap_ns_using \ typemap_numinputs \ typemap_variables \ + typemap_various \ typename \ union_scope \ using1 \ diff --git a/SWIG/Examples/test-suite/typemap_various.i b/SWIG/Examples/test-suite/typemap_various.i new file mode 100644 index 000000000..ac69958a6 --- /dev/null +++ b/SWIG/Examples/test-suite/typemap_various.i @@ -0,0 +1,23 @@ +%module typemap_various + +%typemap(in) SWIGTYPE "_this_will_not_compile_SWIGTYPE_" +%typemap(in) const SWIGTYPE & "_this_will_not_compile_const_SWIGTYPE_REF_" + +%inline %{ +template struct Foo { +#ifdef SWIG + // These typemaps should be used by foo1 and foo2 + %typemap(in) Foo "/*in typemap for Foo */" + %typemap(in) const Foo & "/*in typemap for const Foo&, with type T*/" +#endif +}; +%} + +%template(FooInt) Foo; +%template() Foo; // previously Foo typemaps were being picked up for Python only + +%inline %{ +void foo1(Foo f, const Foo& ff) {} +void foo2(Foo f, const Foo& ff) {} +%} +