diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk index fa46b9ff7..6d1d2a25b 100644 --- a/Examples/test-suite/common.mk +++ b/Examples/test-suite/common.mk @@ -443,6 +443,7 @@ CPP_TEST_CASES += \ typedef_scope \ typedef_sizet \ typedef_struct \ + typedef_typedef \ typemap_arrays \ typemap_array_qualifiers \ typemap_delete \ diff --git a/Examples/test-suite/python/typedef_typedef_runme.py b/Examples/test-suite/python/typedef_typedef_runme.py new file mode 100644 index 000000000..ac61dd163 --- /dev/null +++ b/Examples/test-suite/python/typedef_typedef_runme.py @@ -0,0 +1,5 @@ +import typedef_typedef + +b = typedef_typedef.B() +if b.getValue() == 0: + print "Failed !!!" diff --git a/Examples/test-suite/typedef_typedef.i b/Examples/test-suite/typedef_typedef.i new file mode 100644 index 000000000..bb309cb20 --- /dev/null +++ b/Examples/test-suite/typedef_typedef.i @@ -0,0 +1,39 @@ +%module typedef_typedef + +/* + + We want a specific behaviour on a Type + +*/ + +%typemap(out) A::Foo { + $result = PyInt_FromLong($1 + 1); +} + +%inline %{ + struct A + { + typedef int Foo; + }; + + struct C + { + typedef A Bar; + }; + + struct B + { + C::Bar::Foo getValue() { + return 0; + } + }; +%} + +/* + + An issue can be the steps resolution. + 1) C::Bar is A. So C::Bar::Foo should be first resolved as A::Foo. + 2) Then A::Foo should be resolved int. + If the first step is skipped the typemap is not applied. + +*/