From 2a48aace86e2f4cf57c043bbff5bb75f6c7d1b83 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Fri, 1 Apr 2005 19:49:20 +0000 Subject: [PATCH] test %template() with no given template name uses typemaps - tests part of the template ext mode git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7132 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/Examples/test-suite/common.mk | 1 + SWIG/Examples/test-suite/typemap_various.i | 23 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 SWIG/Examples/test-suite/typemap_various.i 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) {} +%} +