diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk index bc309cf76..59142d5a0 100644 --- a/Examples/test-suite/common.mk +++ b/Examples/test-suite/common.mk @@ -308,6 +308,7 @@ C_TEST_CASES += \ name \ nested \ newobject2 \ + overload_extend \ overload_extendc \ preproc \ ret_by_value \ diff --git a/Examples/test-suite/overload_extend.i b/Examples/test-suite/overload_extend.i index a892fd9a4..65206c359 100644 --- a/Examples/test-suite/overload_extend.i +++ b/Examples/test-suite/overload_extend.i @@ -1,14 +1,18 @@ %module overload_extend +#ifndef __cplusplus +%typemap(default) double y "$1=1000;"; +#endif + #pragma SWIG nowarn=-302 %extend Foo { int test() { return 0; } int test(int x) { x = 0; return 1; } int test(char *s) { s = 0; return 2; } #ifdef __cplusplus - int test(double x, double y = 0) { x = 0; y = 0; return 3; } + double test(double x, double y = 1000) { return x + y; } #else - int test(double x, double y) { x = 0; y = 0; return 3; } + double test(double x, double y) { return x + y; } #endif }; diff --git a/Examples/test-suite/python/overload_extend_runme.py b/Examples/test-suite/python/overload_extend_runme.py index 48b76c385..7d08d482b 100644 --- a/Examples/test-suite/python/overload_extend_runme.py +++ b/Examples/test-suite/python/overload_extend_runme.py @@ -7,7 +7,8 @@ if f.test(3) != 1: raise RuntimeError if f.test("hello") != 2: raise RuntimeError -if f.test(3.5,2.5) != 3: +if f.test(3,2) != 5: + raise RuntimeError +if f.test(3.0) != 1003: raise RuntimeError -