mirror of https://github.com/swig/swig
Add test for checking prefix resolving in typedef
This commit is contained in:
parent
2f47bb8d67
commit
2e186244d6
|
@ -443,6 +443,7 @@ CPP_TEST_CASES += \
|
|||
typedef_scope \
|
||||
typedef_sizet \
|
||||
typedef_struct \
|
||||
typedef_typedef \
|
||||
typemap_arrays \
|
||||
typemap_array_qualifiers \
|
||||
typemap_delete \
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
import typedef_typedef
|
||||
|
||||
b = typedef_typedef.B()
|
||||
if b.getValue() == 0:
|
||||
print "Failed !!!"
|
|
@ -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.
|
||||
|
||||
*/
|
Loading…
Reference in New Issue