Added test case for a forward declaration in a typedef with the same

name
This commit is contained in:
David Avedissian 2017-12-27 16:31:16 +00:00
commit 6b2bcfed0b
3 changed files with 33 additions and 0 deletions

View file

@ -490,6 +490,7 @@ CPP_TEST_CASES += \
throw_exception \
typedef_array_member \
typedef_class \
typedef_classforward_same_name \
typedef_funcptr \
typedef_inherit \
typedef_mptr \
@ -676,6 +677,7 @@ C_TEST_CASES += \
string_simple \
struct_rename \
struct_initialization \
typedef_classforward_same_name \
typedef_struct \
typemap_subst \
union_parameter \

View file

@ -0,0 +1,22 @@
import typedef_classforward_same_name.*;
public class typedef_classforward_same_name_runme {
static {
try {
System.loadLibrary("typedef_classforward_same_name");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
System.exit(1);
}
}
public static void main(String argv[]) {
Foo foo = new Foo();
foo.setX(5);
if (typedef_classforward_same_name.extract(foo) == 5) {
// All good!
}
}
}

View file

@ -0,0 +1,9 @@
%module typedef_classforward_same_name
%inline %{
typedef struct Foo Foo;
struct Foo {
int x;
};
int extract(Foo* foo) { return foo->x; }
%}