Skip to content

Commit 47eb9c8

Browse files
committed
Extend "ignore" parameter test
- Ensure that `argout` is called even when a parameter is ignored - Ensure that ignored parameters with default arguments are handled correctly
1 parent ef11208 commit 47eb9c8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Examples/test-suite/ignore_parameter.i

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,19 @@
33
%module ignore_parameter
44

55
%typemap(in,numinputs=0) char* a "static const char* hi = \"hello\"; $1 = const_cast<char *>(hi);";
6-
%typemap(in,numinputs=0) int bb "$1 = 101;";
6+
%typemap(in,numinputs=0) int bb "$1 = 101; called_argout = 0;";
77
%typemap(in,numinputs=0) double ccc "$1 = 8.8;";
88

99
%typemap(freearg) char* a ""; // ensure freearg is not generated (needed for Java at least)
1010

11+
%typemap(argout) int bb "called_argout = 1;"
12+
1113
%ignore unignorable;
1214

1315
%inline %{
16+
// constant for detecting correct "argout" call
17+
int called_argout = 0;
18+
1419
// global function tests
1520
char* jaguar(char* a, int b, double c) { return a; }
1621
int lotus(char* aa, int bb, double cc) { return bb; }
@@ -25,6 +30,7 @@ struct SportsCars {
2530
double bugatti(char* aaa, int bbb, double ccc) { return ccc; }
2631
int lamborghini(int bb) { return bb; }
2732
int maseratti(int unignorable) { return unignorable; }
33+
double audi(double ccc=9.5) { return ccc; }
2834
};
2935

3036
// constructor tests

0 commit comments

Comments
 (0)