diff options
Diffstat (limited to 'Examples/test-suite/implicittest.i')
| -rw-r--r-- | Examples/test-suite/implicittest.i | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/Examples/test-suite/implicittest.i b/Examples/test-suite/implicittest.i new file mode 100644 index 0000000..91205aa --- /dev/null +++ b/Examples/test-suite/implicittest.i @@ -0,0 +1,68 @@ +%module(naturalvar="1") implicittest + +%implicitconv; + +%inline +{ + struct B { }; +} + +%inline +{ + struct A + { + int ii; + A(int i) { ii = 1; } + A(double d) { ii = 2; } + A(const B& b) { ii = 3; } + explicit A(char *s) { ii = 4; } + + int get() const { return ii; } + + }; + + int get(const A& a) { return a.ii; } + + template <class T> + struct A_T + { + int ii; + A_T(int i) { ii = 1; } + A_T(double d) { ii = 2; } + A_T(const B& b) { ii = 3; } + explicit A_T(char *s) { ii = 4; } + + int get() const { return ii; } + + }; +} + +%inline +{ + struct Foo + { + int ii; + Foo(){ ii = 0;} + Foo(int){ ii = 1;} + Foo(double){ ii = 2;} + explicit Foo(char *s){ii = 3;} + Foo(const Foo& f){ ii = f.ii;} + + }; + + struct Bar + { + int ii; + Foo f; + Bar() {ii = -1;} + Bar(const Foo& ff){ ii = ff.ii;} + }; + + + int get_b(const Bar&b) { return b.ii; } + + Foo foo; + +} + +%template(A_int) A_T<int>; |
