Add test for checking prefix resolving in typedef

This commit is contained in:
Yann Diorcet 2013-07-19 16:23:06 +02:00 committed by William S Fulton
parent 2f47bb8d67
commit 2e186244d6
3 changed files with 45 additions and 0 deletions

View File

@ -443,6 +443,7 @@ CPP_TEST_CASES += \
typedef_scope \
typedef_sizet \
typedef_struct \
typedef_typedef \
typemap_arrays \
typemap_array_qualifiers \
typemap_delete \

View File

@ -0,0 +1,5 @@
import typedef_typedef
b = typedef_typedef.B()
if b.getValue() == 0:
print "Failed !!!"

View File

@ -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.
*/